Flipping Animated Question..

Discussion in 'iOS Programming' started by IDMah, Dec 6, 2011.

  1. IDMah macrumors 6502


    May 13, 2011
    Hi all.

    I'm on the interface Front end stage of designing, and want to incorporate a boat load of animation frames.. so...

    1. Is it better to create a sprite sheet of all the frames..
    (if so is there a mac program that will create/ help create the file)

    2. or is it better to just drop all 200 PNGs in to the project.

    3. is I wanted to create a data file for all those frames with either technique:
    1 or 2 How is that done?? or can you point me to somewhere that explains
    the process???

    wow! sorry that seem like a long winded..

  2. ArtOfWarfare, Dec 6, 2011
    Last edited: Dec 6, 2011

    ArtOfWarfare macrumors G3


    Nov 26, 2007
    I wouldn't call myself a pro at this, but I have made an iOS game that uses sprites before.

    My personal method was making all the frames I needed for each animation, giving them names like "RedBird-1.png", with the number incrementing for each frame, and then I threw them all in a folder with just the name (like "RedBird",) and then throwing all the folders of sprites into the resource folder for my project.

    Just be careful about not using the same names for multiple files... when the project is bundled up for distribution all the folders are removed and all the files they contained are moved to a special folder within the app bundle (I forget which, it's not important as NSBundle handles it for you automatically.)

    What I'm saying is, you can't just have "Frame1.png", "Frame2.png", etc. inside of "RedBird" and then also "Frame1.png", "Frame2.png", etc. inside of "BlueBird"... the system would consider the files to be the same... I'd guess which image got displayed would be random, if it allows you to have same name files in Xcode at all.

    If you'd rather pursue Sprite Sheets (my understanding is the advantage is that they make more effective use of memory... you'll have fewer garbage bytes consumed by the image, but unless you're really pushing the iOS devices as hard as you can, you wouldn't actually see the improvement at all,) you might want to look into Cocos2D. I've never used it personally, but it's my understanding that it can automate the difficulties of using sprite sheets instead of individual frames.
  3. IDMah thread starter macrumors 6502


    May 13, 2011
    cool cool.

    Thanks !!! I'll try it.

    What's the best way to hold a image for XX seconds and then
    have it play say 4-8 frames normally at 30 fps then go back to holding for XX seconds. I thought of triggering start / stopAnimating with a timer but that seem quite archaic/ hacky..

    Question Should I not use UIImage Animation and roll my own animation player? Where I explicitly define the time a frame is held for..

    Frame0,1 (seconds) Frame1, 0.03 (seconds), etc.. for all frames.
    then just slap/ replace the frame after N seconds.. again using the timer function??

    Is there an easier way???


Share This Page