开发者

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜