Monday, June 20, 2011

Create a Racing Game Without a 3D Engine

This tutorial will give you an alternative to 3D for racing games in ActionScript 3. No external framework is required for this old-school style example.


Final Result Preview

Let’s take a look at the final result we will be working towards:


Step 1: Set up the FLA Document

Create a new Flash document set for ActionScript 3.0. I’ll be using dimensions of 480x320px, a frame rate of 30 FPS, and a light blue background. Save the file with a name of your choice.

Set up the FLA Document

Step 2: Create a Document Class

Besides the FLA, we also need to create a document class. Create a new Actionscript file, and add this code:

package
{
 import flash.display.MovieClip;

 public class Main extends MovieClip
 {
  public function Main()
  {

  }
 }
}

Save this file in the same directory as our FLA. Name it Main.as.


Step 3: Link the Main Class with the FLA

In order to compile the code from the Main class, we need to link it with the FLA. On the Properties panel of the FLA, next to Class, enter the name of the document class, in this case, Main.

Link the Main class with the FLA

Then, save the changes on the FLA.


Step 4: Draw a Road Line

[...]

Read more: Create a Racing Game Without a 3D Engine

No comments:

Post a Comment