Search code examples
objective-cimageanimationmove

Objective-C: Better animation


Im working on a simple cups and ball game and right now I am making the cups move by using

_image.animationImages = [NSArray arrayWithObjects:... and then having all of the images in the animation but each animation is about 200 images which is making it really big and slow, is there a way to have each cup move along a curve I set and just have the one image of the cup instead of the thousands for all the animations?

And also I plan to be able to have different cups to choose from, is there a way I can put all the cups in a sprite sheet instead of having each individual image? I do not want to use cocos2d because I am not familiar with it and do not want to restart this project.


Solution

  • You should look into SpriteKit.

    https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Introduction/Introduction.html

    Specifically, here's an example for moving an object along a curve:

    http://www.ioscreator.com/tutorials/moving-sprites-path-sprite-kit