Reputation: 621
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 moving.
Sounds confusing I know, anyone have ideas, or question i could answer to clear it up.
Thanks in advance
Upvotes: 0
Views: 216
Reputation: 1939
? isnt it:
if(tile.position.y>player.position.y)
{
//player cont moving
}
else
{
//collided
}
Upvotes: 1