Game Development Reference
In-Depth Information
m_verifyArray[3] == -3 )
markWin(3, -1);
}
}
for each (var verifyElement:int in m_verifyArray) {
if (verifyElement == 3 || verifyElement == -3) {
return verifyElement;
}
}
return (m_hotspotArray[checkRow]
[checkColumn].value!=0)?1:0;
}
Finding the winner
When the game has been won by a player, we want to show how it was won. The
following method turns the winning row or column or the diagonal hotspots to true :
private function markWin(type:int, index:int):void {
switch (type) {
case 0: {
m_hotspotArray[0][index].win = true;
m_hotspotArray[1][index].win = true;
m_hotspotArray[2][index].win = true;
break;
}
case 1: {
m_hotspotArray[index][0].win = true;
m_hotspotArray[index][1].win = true;
m_hotspotArray[index][2].win = true;
break;
}
case 2: {
m_hotspotArray[0][0].win = true;
m_hotspotArray[1][1].win = true;
m_hotspotArray[2][2].win = true;
break;
}
case 3: {
m_hotspotArray[0][2].win = true;
m_hotspotArray[1][1].win = true;
m_hotspotArray[2][0].win = true;
break;
}
 
Search WWH ::




Custom Search