Game Development Reference
In-Depth Information
public static var TIE:int = 103;
}
}
Initializing the game screen
The init method is listed as follows. The init method is called only once during the
entire game execution.
public override function init():void {
super.init();
//init the border sprite
var borderBitmapAsset:BitmapAsset
= new Border() as BitmapAsset;
m_borderSprite = new Sprite();
m_borderSprite.graphics.
beginBitmapFill(borderBitmapAsset.bitmapData);
m_borderSprite.graphics.
drawRect(0,0,borderBitmapAsset.width,
borderBitmapAsset.height);
m_borderSprite.graphics.endFill();
m_borderSprite.x = 150;
m_borderSprite.y = 120;
//init the 9 hotspots sprite array
var hotspotBitmapAsset:BitmapAsset;
hotspotBitmapAsset = new HotSpot() as BitmapAsset;
m_hotspotArray = new Array();
var x:int, y:int;
var y_offset:int = 0;
for ( x=0; x < 3; x++) {
m_hotspotArray[x] = new Array();
var x_offset:int = 0;
for ( y=0; y < 3; y++) {
var hotspot:TictactoeHotspot;
hotspot = new TictactoeHotspot(x, y);
m_hotspotArray[x][y] = hotspot;
hotspot.graphics.
beginBitmapFill(hotspotBitmapAsset.bitmapData);
hotspot.graphics.
drawRect(0, 0,
hotspotBitmapAsset.width,
hotspotBitmapAsset.height);
hotspot.graphics.endFill();
 
Search WWH ::




Custom Search