I have a sprite sheet containing frames for a person that correspond to a number of different actions, such as “walk_left”, “walk_right”, etc… These actions might have a different number of frames but within each action there will only be one certain area of the sprite that I would like to have detect collisions with other objects.
Is there a way to set up a complex body for each of these actions ? Bearing in mind that “walk_left” ‘s complex body might contain a complex body at different coordinates from “walk_right”
Any help and/or examples would be useful ?
I can provide code if this helps.
What I do in those cases are actually create several “characters” one for each animation, and then switch them on the fly as needed…
So you have one newSprite with the walk_left animation and with a collision where I want, another walk_right, and so on…
Just keep in mind that using Box2D you will have to move them all at once (Box2D dislike you moving objects suddenly).
If you don’t use Box2D and are handling collisions yourself, then just create several collisions on the same object, one for each animation, and use object.getSequence to see what animation is playing, and use the collision you want, maybe something like