Game Development Reference
In-Depth Information
case 4: {
for(var r:int = 0; r<3; r++)
for(var c:int=0; c<3; c++)
m_hotspotArray[r][c].win = true;
break;
}
}
}
After the hotspots have been marked, we call the showEndGame method, which
will keep the winning symbols and dissolve them slowly; the others are removed
immediately. This will let the players know how the game was won.
private function showGameEnd(result:Sprite):void {
result.x = 400 - result.width/2;
result.y = 300 - result.height/2;
addChild(result);
// Display the game result
var a:Array = new Array();
a.push(result);
var sd:SpriteDissolve;
sd = new SpriteDissolve(this, a);
sd.play();
// Fade away the wins only
a = new Array();
for(var r:int = 0; r<3; r++) {
for(var c:int=0; c<3; c++) {
if (m_hotspotArray[r][c].win) {
a.push((m_hotspotArray[r][c] as
Sprite).getChildAt(0));
}
}
}
sd = new SpriteDissolve(this, a);
sd.play();
}
 
Search WWH ::




Custom Search