Arlefreak Posted November 12, 2013 Share Posted November 12, 2013 is there a way to handle collisions of an object depending on the side colliding? for example top, bottom, left, , right so for example I have a character and I want it to do something when it collides on the left side of a sprite, but when it is on top, just continue. PD: i think the chat is down, I don't know if it is known. Link to comment Share on other sites More sharing options...
Vidsneezes Posted November 12, 2013 Share Posted November 12, 2013 Assuming your player is just moving towards the top. I would probably put some logic in a collisionHandler function.To check if the playerObject(obj1) is below (y-axis) the collisionObject(obj2) at the moment the collision occurs.If is not below , then that means the collision occurred from the side.Another way i was thinking of doing this, is by having a sprite vs group collision check. What you want to do is add all the sprites that are below the playerObject to this group. This way you don't worry about the sprites that are not in the group. Link to comment Share on other sites More sharing options...
Arlefreak Posted November 12, 2013 Author Share Posted November 12, 2013 Thanks for the response! I wanted to know if it was some way implemented but it doesn't seem so hard to do it myself, also i was thinking about a sprite 1px width and add it to my object so the collision would only be with it.I will try it and see how does it goes. Assuming your player is just moving towards the top. I would probably put some logic in a collisionHandler function. PD: the link for the collision handler seems to be broken Link to comment Share on other sites More sharing options...
mjablonski Posted November 12, 2013 Share Posted November 12, 2013 Hi, you can also check sprite.body.touching.left(or all other directions) in your collision handler. HTH, Maik Arlefreak, thyagoluciano and plicatibu 3 Link to comment Share on other sites More sharing options...
Recommended Posts