Do you like my tutorials?

Then consider supporting me on Ko-fi

Talking about Actionscript 3, Flash, Game development and iOS.

Do you remember Christian Östman and his Flash 3D game A Small Car?

He’s back with Pixel City Skater, a free (for a limited time) game for iPhone made with Flash and AS3.

As usual, he shares his experience with us:

Pixel City Skater is the first iPhone game we’ve made. We wanted to try and see if it was possible to use Flash and AS3 to create a game for iOS and get it to the market. Using Adobe Air 2.6 it’s possible to create an iOS Application from your AS3-projects. While Air 2.7 is just around the corner, adding Flex-support and increased performance we didn’t have access to a pre-release of it so 2.6 had to do. As we didn’t have alot of time for the project we needed a very simple game-idea that could be done in pretty much a day. After some quick testing we decided on a small one-button game with a skateboarder.

To make the game we used Flash Builder 4.5 and the Flixel frameweork. It seemed like a good idea as it uses blitting to draw everything on screen to a bitmapdata, making it very suitable for mobile devices. It also made it pretty easy to support the different resolutions for the iPhone4 and the older models.The way we do it is simple, the game is running at half the standard iPhone resolution, 120×240. All the graphics and bitmaps is designed for that size. When the game loads we do a check (using the Capabilites class) what resolution the device we’re running on has. If it’s 320*480 (iPhone 3GS) we tell Flixel to scale the game x2. If the resolution of the device is 640×960 (Iphone 4) the game is scaled x4. This is a technique often used in pixel-style games to make the pixels appear bigger.

When we first tried the game on an actual device it was running very slow. The problem seemed to be that we hadn’t set the rendering mode of the application to GPU in the application descriptor file. After that the game was running much smoother on the device. Even the blood-particles, with gravity and collision, when the skater died rendered with no problems (Adding more than a 100 particles at the same time seemed to slow it down though).

Adding sound and music to the game was the same as a normal AS3-project, and it worked perfectly on the first try.
We used Local Shared Object to save the gamestate and scores when the app was closed. I was a bit surprised to see that working without any problems.

We started working on the game on a thursday and it was finished on the next day (Friday (partying). We-we-we so excited). After that we sent the game to the App Store and it was approved about a week later.The game is available on the App Store and it’s currently free for about a week (until June 3) so if y

ou have an iOS-device you can try it out, with no charge: Get Pixel City Skater from the App Store for free for a limited time!

There’s alot of room for improvements in the game.
One thing would be to use special bitmaps for the iPhone4 Retina display, as scaling it 4x this way makes it loose some of it’s sharpness on the display. A big plus creating games using this way is that we could also release it for Android devices, the Playbook and a web-version with minimal changes.

Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.