开发者

Cocos2D for First Game - Advice for Beginner

开发者 https://www.devze.com 2023-04-08 23:07 出处:网络
I never developed in Cocos2D. However, this animated app is not easy to make with regular UIView animation and CAAnimation.

I never developed in Cocos2D. However, this animated app is not easy to make with regular UIView animation and CAAnimation.

I want a number of UIImageView's (from 1 to 30) to float around the screen with the certain path and I want them to be responsive for touch (they would do some animation when touched开发者_开发百科). I also need them to go back and forth the screen (new path would be calculated) when they are touched or reach the edge of screen. It's important to retrieve X and Y position of each element whenever needed.

Question is: what Cocos2D classes are best looking at (for a beginner) to make that happen? I've tried UIView animation and CAAnimation but I came across some difficulties so I have a feeling Cocos2D may bring better results. Thank you.


Yes, cocos2d makes it much easier. You want to create a CCSprite with the initWithFile: method. Example:

CCSprite *mySprite = [CCSprite initWithFile:@"fire.png"];
[self addChild:mySprite];

Where fire.png has been added to the project and self is the scene instance.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号