Game Development Reference
In-Depth Information
The startGame method is called on all the player clients when the host clicks on the
go sprite. The field m_putValue is initialized, which is used to determine whether an
O or X should be displayed.
public override function startGame():void {
super.startGame();
if ( PulseGame.getInstance().
getGameClient().isGameHost() ) {
m_putValue = 1;
}
else {
m_putValue = -1;
}
addChild(m_borderSprite);
for each (var hotspotArray:Array in
m_hotspotArray) {
for each (var hotspot:TictactoeHotspot in
hotspotArray) {
m_borderSprite.addChild(hotspot);
}
}
m_isGaming = true;
}
The super implementation removes the go or the wait sprite. The game board is now
displayed to the player.
In the following hide method, we simply make sure we remove every game
screen-related sprite:
public override function hide():void {
super.hide();
if(m_borderSprite.numChildren > 0) {
for each (var hotspotArray:Array in
m_hotspotArray) {
for each (var hotspot:TictactoeHotspot in
hotspotArray) {
if(hotspot.numChildren > 0)
hotspot.removeChildAt(0);
m_borderSprite.removeChild(hotspot);
}
}
}
if(m_isGaming) {
removeChild(m_borderSprite);
 
Search WWH ::




Custom Search