Question

I want to detect a jump on an enemies head (like in super mario). How can I do this?

If you didn't understand what I mean just say something :)

I dont need to use cocos2d but it would be better with that :)

Was it helpful?

Solution

I'm not familiar with cocos2d so I can't help with specifics but:

If you can determine the player collided with an NPC, just check if the bottom of the player is what collided with the top of the NPC. If it did, he must have landed on his head.

To be extra sure, you could also check if the player's velocity states that he's moving down but that's probably not necessary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top