When the initial version of Adobe Flash Professional CS5 was released in 2010, its performance was extremely slow even for the most simplistic games. With the CS5.5 update, the errors were fixed and Flash became a reliable option for creating simple iPhone games.
Developing games in Flash is really easy. Don’t underestimate simplicity; Flash CS5 enables you to create a basic game and export the content to the web and Android without making serious changes to the code.
If you want to start from the foundation, you can learn how to use Flash CS5 and CS5.5 through the tutorials provided at ADOBE TV website. If you are looking for a simpler guide on creating games for iPhone, follow the steps listed below!
- Get started!
Download Flash Professional CS5.5 from the official Adobe website. Once you set everything up, the real fun can start.
Now you can create a new document in the program. Select File, and then New. The type of document should be set to “Air for iOS”, and the framerate should be 60fps. In order to make your game suitable for the iPhone screen, you should adjust the size of your document to 640 pixels wide by 960 pixels high. If you want to create a game for a non-retina iPhone display, then keep the default size of 320×480 pixels.
Congratulations, you’re done with the first part.
- Creating graphics
After creating a document, you will find yourself in front of a blank space that’s ready for your flash app. If you are not an Apple developer, you will need to join the Apple Developer Program before you can proceed and send the games you create to the App Store.
Now let’s create a graphic (you can do that directly from the app). Click on Insert, and then choose the New Symbol option. Name your symbol. Let’s use the name “Rabbit” as an example. Click on Advanced and make sure the same name is auto-filled in Class. Then click OK and start creating the symbol.
Draw the graphic. Flash CS5 enables you to rely on your creativity, so use that opportunity.
- Write a code
Your graphic needs a code. Go to File -> New, and choose “Actionscript 3.0 Class”. Name and save the class (for example “RabbitM”, which will be auto filled to RabbitM.as).
Go back to the project and switch back to Scene in the breadcrumb bar. In properties, switch Class property to “RabbitM” – the class you created for the code.
- Import the Sprite class
Now you’ll need to replace the contents of RabbitM in order to import the needed Sprite class and add the graphic to the screen. After that, save the flash project under another name in the same folder as Rabbit.as and hit CTRL & Enter to see how your creation looks like.
You will see your graphic in the top-left corner. This means that you need to create another code to make the rabbit follow the user’s touch on the screen. Then, you can create new graphics in a similar way.
Switch back to the Flash projects and insert a new symbol. Pick another name for the symbol and repeat the same steps.
- Make the symbols react to one another
You will need more complicated software for advanced hit detection, but you can use Flash CS5 for a really simple iPhone game. First you will need to identify the coordinates of the rabbit with variables, so the moving direction will be calculated. Then, you’ll add variables to record the direction that the other symbol is being moved in.
Once you’re done with that, you’ll need to add a function that will be fired on every enter frame. If you set the game to 60fps, the function will be fired 60 times in a single second. If you make the game too busy, the function won’t be fired with full speed, so you shouldn’t expect to get constant 60 frames per second.
- Adding sound effects
When you are sure that the hitting mechanics function well, you can proceed with importing sound effects. Select your Flash projects, choose File -> Import, and then click on Import to Library.
The wav file will appear in the library pane on the right side of the screen. You need to provide an AS Linkage name to that file in order to make it available to the code.
- Finishing touches
In order to run the game smoothly on an iPhone, you need to optimize it. Setting the stage quality to low is a simple way to achieve better performance. Don’t be concerned about the visual aspect; this choice won’t affect its quality too much.
You will probably find the process of setting up the certificates in the deployment tab a bit confusing, but you can follow this guide provided by Adobe.
These basic instructions won’t be enough for developing an awesome game for iPhone, but you’ll form a solid foundation with a lot of practice. Then, you can proceed to greater challenges.