How to check if player.position.y is higher than a tile
Hey, basically I am trying to do collision in cocos2d. I have him falling and when he touches the platform, which has an invisible tile on top of it ( used for checking if it touches player) he stops moving.
The way I did my collision was so if he came in contact with a collidable tile he would stop all movement, ie left and right.
What i thought would work was checking if the tile the player was colliding with, 'y' is higher than that of the player then carry on moving, if not then stop mo开发者_开发技巧ving.
Sounds confusing I know, anyone have ideas, or question i could answer to clear it up.
Thanks in advance
? isnt it:
if(tile.position.y>player.position.y)
{
//player cont moving
}
else
{
//collided
}
精彩评论