Placing the snake

Let's start placing the snake. Without closing snake.fla, create a new file and from New Document window select ActionScript 3.0 Class. Save this file as in the same path you saved snake.fla. Then write:

package {
import flash.display.Sprite;
public class Main extends Sprite {
private const FIELD_WIDTH:uint=16;
private const FIELD_HEIGHT:uint=12;
private const TILE_SIZE:uint=40;
private var the_snake:the_snake_mc;
private var snakeDirection:uint;
private var snakeContainer:Sprite= new Sprite();
private var bg:bg_mc=new bg_mc();
public function Main() {

You should be used to seeing the making of a game start this way: we are importing the required classes (Sprite in this case), defining ...

Get Flash Game Development by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.