Game Development Reference
In-Depth Information
private function keyUpListener(e:KeyboardEvent):void {
keyPressList[e.keyCode]=false;
}
}
}
The only real code worth noting in this set of stub functions relates to the internal game state
machine. Just like the Main class, the systemFunction function reference is called each game
timer tick. The switchSystemFunction function is used to change to a new state.
If you run this code, you should see a pretty much black game screen after the purple level in
screen fades away. You will need to click trough the title and instructions screens first. Figure 10-
6 is an example of this less-than-exciting game screen.
Figure 10-6. The stub game in action
Setting up the game (iteration 3)
The final output of this iteration will be to place the player's car on the screen. Don't let looks be
deceiving though; this iteration accomplishes much more than that. We will initialize a new game,
read in the tile sheet data, read the first levels, and prepare to play the level.
The init function
The full code for the init function follows:
private function init():void {
camera.width=384;
Search WWH ::




Custom Search