[ios] A object have multil aniamtions


#1

I have an object with many animations. so i thinks 2 solution :

  • one sprite with animation (but rectangle diffent)
  • many sprite, one sprite is an animation .
    So can u help me
    I use cocos2dx

#2

Having 1 image with all the animation frames in that 1 image is neater than having lots of individual images.

If you use a sprite packer app it will create the combined image and a plist file that contains the frame list.
This can then be loaded in to cocos2dx and used to play the required animation.

Google cocos2dx animation and you should find loads of info.


#3

But animations have diffence rectangle, so when detect collision by box2d is hard for me.
Can you share me code for this .


#4

In my app, I make sure that the box2d shape can roughly contain all the animation frames.
I don’t care if a small part is sticking out.

If your animations can contain shapes that are very different to the base image then you might have to try a different approach.

I use a 3rd party tool to create the sprite sheets, animations and box2d physics shapes so don’t have any code to share (the tool creates the required code for me).


#5

so what tools you use??


#6

I use SpriteHelper and LevelHelper, http://www.gamedevhelper.com/
OSX only but both are on iTunes and the app developer also sells a pro version from his site with more features.

It creates c++ classes so is cocos2dx compatible.


#7

so,anybody have other solution for this issue:(


#8

Have you looked at CocosBuilder?