Flash - Project Wall

A game created in college. Collect all of the coins while using the least amount of moves in the least amount of time.

Getting Started

What's super cool about Flash and ActionScript is that you can have multiple objects on the screen with the same name at the same time. Just draw a shape on your screen and convert to a symbol/movie clip and you are on your way. An example would be if you wanted a player to collect coins or even player collision.

var verticalSpeed:Number;                       //vertical speed of the player
var horizontalSpeed:Number;                     //horizontal speed of the player
var dir:Number;                                 //direction on where the player is facing

var movementCtr:Number = 0;                     //number of turns a player makes
var coinCtr:Number = 0;                         //number of coins a player collects

var wallArray:Array = [];                       //collection of in-game walls where the player crashes and dies
var coinArray:Array = [];                       //collection of in-game coins where the player can collect

var didNotFinish:String = "false";              //did the player reach the finish line? default is no/false

var playTimer:Timer = new Timer(1000,0);        //time the player in how long it takes to complete the maze
var playTime = 0;

Now to declare the direction constants on which the player is facing.

//direction constants
const NORTH:Number=0;
const NORTHEAST:Number=1;
const EAST:Number=2;
const SOUTHEAST:Number=3;
const SOUTH:Number=4;
const SOUTHWEST:Number=5;
const WEST:Number=6;
const NORTHWEST:Number=7;


The init() function will control variables like the player speed and direction. The loadWalls() function finds all the objects with the movie clip name "wall" and pushes it into an array -- the same with loadCoins() function but for coins.

Events will listen right away on the player's controls, follow the player with a camera, and starts detecting if a player touches a coin.

A simple timer to time the player on how long it takes to complete the challenge.

//Load Functions



Coin Collection

When a coin is collected, play a sound, remove only that coin from the scene and add that coin to the player's score.

function coinCollection(Evt:Event){
  for each(var coin:Sprite in coinArray){
        var coinSound:Beep = new Beep(); 
        coinCtr += 1;
        numbCoinsText.text = String(coinCtr);

Map Construction

The map extends well beyond the scene but the background stays the same and the camera follows the player.

Project Wall Map