I'm in the process of developing a 2D fighting game in the same style as Capcom's Street Fighter Alpha for the iPhone. For collision detection, I'm thinking about creating several hit boxes per sprite frame in an animation and checking for collisions between them in the main game loop. Are there any tools for creating hit boxes on sprites and generating this metadata (say in a .plist or .xml)?
How have other 2D fighting games developed by the cocos2d iPhone community handl开发者_StackOverflowed collision detection and the generation of useful metadata?
Thanks for the forthcoming responses.
In a fighting game, collision detection is actually not performed (or should not be performed, that is).
What you would want to do is determine the distance of Player A from Player B when Player A performs an "attack". Player A's attacks are "static":
High Punch = 64px reach
Low Punch = 54px reach
Mid Punch = 45px reach
High Kick = 64px reach
etc, etc, etc
You would then determine, based on the attack performed and the distance to Player B, and the current state of Player B - whether the attack "landed", was "blocked" or "missed" (High Kick Attack against Crouched Enemy is "miss", while Low Kick Attach with Crouched Enemy NOT in Block is a "hit").
It's a series of "rules" - if the two players are within a specific distance of each other, and the states of each player are correct for the attack, then the attacker "lands", or the defender "blocks" or the attacker "misses".
精彩评论