I am developing a game. I have a problem, I added a physical body at some height. I want that when player jumps on its upper side he can stand on it, but when player collides with its left side or down side he can pass through it without collision. Any help…
Share
While checking for collision, when collided, take the position of player (getX() and getY()), then calculate the bottom position of the player. After that compare it with the position (getX() and getY()) physical body.
if getX() of physical body is greater than player’s getX() and getY() of physical body is less than that of player means the player is on the left side.
similarly you can find the other positions and based on which you can initiate the actions.