Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocos2d - animationwithframes:delay: deprecated

I would like to know what I should use in place of

animationWithFrames:delay:

and

actionWithAnimation:restoreOriginalFrame:

since they give a warning that they've been deprecated.

like image 846
wilM Avatar asked Jun 13 '12 19:06

wilM


2 Answers

Cocos2d 2.0 uses

CCAnimation

+(id) animationWithSpriteFrames:(NSArray*)frames delay:(float)delay

CCAnimate

+(id) actionWithAnimation: (CCAnimation*)anim

Docs:

http://www.cocos2d-iphone.org/api-ref/2.0.0/interface_c_c_animation.html

http://www.cocos2d-iphone.org/api-ref/2.0.0/interface_c_c_animate.html

like image 173
Ben Trengrove Avatar answered Nov 15 '22 21:11

Ben Trengrove


The only change you need to do is uses the new property: restoreOriginalFrame.

Remove restoreOriginalFrame from the constructor, then, in a new line, set the property:

animation.restoreOriginalFrame = NO;

That's it!

like image 27
Julio César Fernández Muñoz Avatar answered Nov 15 '22 20:11

Julio César Fernández Muñoz