Hi, i have a box like obstacle in my game, but i want that the player collision with the left side of box lose, but if collision on top or any side, the game continues.
How can i do that??
I would suggest maybe create a sprite and pin it to the side of your rectangle where you want the collision to occur for you to lose. Make this sprite invisible. Then if your player collides with this invisible sprite, set your actions for your player.
Is a good idea, but the problem is that i have many boxes, but that boxes have the same properties.
Maybe this could help you with that
Develop games in your browser. Powerful, performant & highly capable.
you could also look at the relative x (&y) coordinates of the two colliding sprites and make a decision on these
You could use 'overlapping at offset' if player and box both are solid.
Player Is overlapping Box at offset(1,0) -> die
You might even be able to use the bounding box edges for checking, depending on the way you have set things up..