- install xcode
- goto http://www.cocos2d-iphone.org/
- click download tag, and download stable version
- create a directory on mac, set it call cocos2d
- uncompress and move to cocos2d directory
- open terminal and goto cocos2d-iphone-VER directory
- use "sudo ./install-templates.sh" to install
- when pup a window that you keyin password to contiune to finish.
- open xcode and click cocos2d project, and you can see three project templates
- choose a template to create new project and building after see a hellow world on screen
- if happen warning like this "uniqueIdentifier is deprecated", you can find out those line and command out. because iOS can`t create UDID, but apple have a method to create it.
add a png
- copy a png file to project, ex:test.png
- edit filename"layer".m
- add code and run, you can see test.png on screen and moving.
// start
// add a png at screen
CCSprite *spacePng = [CCSprite spriteWithFile:@"test.png"];
[spacePng setPosition:ccp(100, 100)];
[self addChild:spacePng];
// let this png moving
id moveAction = [CCMoveTo actionWithDuration:5.0f position:ccp(300, 200)];
[spacePng runAction:moveAction];
// end
沒有留言:
張貼留言