Study Guides (390,000)
CA (150,000)
SFU (5,000)
IAT (80)
IAT 167 (20)
Final

IAT167-Game Setup Example.docx


Department
Interactive Arts & Tech
Course Code
IAT 167
Professor
Jack Stockholm
Study Guide
Final

This preview shows half of the first page. to view the full 2 pages of the document.
package
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.getTimer;
public class Game extends MovieClip
{
//properties
public static const STATE_INIT:int = 10;
public static const STATE_PLAY:int = 20;
public static const STATE_GAME_OVER: int = 30;
public static const CLICKS_MAX: int = 10;
public var gameState:int = 0;
public var clicks:int = 0;
public var lastClickTime:int = 0;
// constructor
public function Game():void
{
addEventListener(Event.ENTER_FRAME, gameLoop)
gameState = STATE_INIT;
}
public function gameLoop(e:Event):void
{
switch(gameState)
{
case STATE_INIT:
initGame() ;
break;
case STATE_PLAY:
playGame();
break;
case STATE_GAME_OVER:
gameOver();
break;
}
}
You're Reading a Preview

Unlock to view full version