Monday, 23 July 2012

Monday, 23 July 2012

Where Do I Begin: Make an iOS Game

I sometimes get asked the question "How do I make an iPhone game?" so here's the answer.

Step 1: Get a Mac. You may not like it, but it's the only way. (link)
Step 2: Download and install Xcode from the Mac App Store. (link)
Step 3: Download cocos2d-x and install the Xcode templates. (link)
Step 4: Create a new project in Xcode. Pick one of the cocos2d-x templates. I recommend going with the box2d template, but if you'd rather write your own collision detection then pick the plain cocos2dx template. (Help at the bottom of the page)
Step 5: Make the game! I recommend pen and paper to sketch down some rough ideas and then have at it. (link)

There are already plenty of tutorials out there on the specifics of making a game with cocos2d-x so if you're stuck try a few of them out. What you essentially need to know is that all your graphics will be images that you can create with your favourite editor (flash, photoshop, fireworks, painter, etc). Once you've imported your assets you can use them like so:
CCSprite *mySprite = CCSprite::spriteWithFile("myImage.png");
mySprite->setPosition(ccp(480.0/2.0, 320.0/2.0));
this->addChild(mySprite);
Providing your app is landscape, this code will create a sprite, center it and then add it to the display.

Help Installing Templates: Using terminal navigate to the cocos2d folder and run "./install-templates-xcode.sh -u -f"
Categories: ,

0 comments: