home *** CD-ROM | disk | FTP | other *** search
Wrap
property pEndOfGame, pSetNextLevel, pTicks, pBlink global gGameState, gLevelNum, gGameOverTime, gCurMoveNum, gJuggleTime, gTraceMap, gComputerPlayer, gHumanMove, gScorePlayer1, gScorePlayer2, gPlayerWon, gPlayAnimation, NUM_SQUARES, gDifficulity, gLevel, gPoints, gpvMainBoard, gAniPairRed, gAniPairBlue, gAniPairWon, gAniPairLost, gStartLevel, gBonus, gCheater, gBlueBored, gDidntCount, gMouseOn, gSoundEnabled, gOldKey on beginSprite me pEndOfGame = 1 pSetNextLevel = 1 end on enterFrame me yawned = goUpdate(gGameState) if gGameState = #startNewGame then setGameState(#player1Move) gBlueBored = 0 gDidntCount = 0 else if gGameState = #player1Move then if goNumPossibleMoves(1) = 0 then if goNumPossibleMoves(2) = 0 then setGameState(#Endgame) else setGameState(#player1Passing) end if else if gComputerPlayer[1] then goStartComputerMove(1) setGameState(#waitingComputer1) else gHumanMove = 0 setGameState(#waitingHuman1) end if end if else if gGameState = #waitingHuman1 then sprite(9).locH = 81 if gHumanMove > 0 then if goCheckValidMove(gHumanMove, 1) then goTransitionBoard(gHumanMove, 1) goSetPiece(gHumanMove, 1) setGameState(#player1Done) else setGameState(#player1BadMove) end if end if else if gGameState = #waitingComputer1 then if pBlink = 1 then sprite(9).locH = 81 pTicks = pTicks + 1 if pTicks = 6 then pBlink = 0 pTicks = 0 end if else sprite(9).locH = -100 pTicks = pTicks + 1 if pTicks = 3 then pBlink = 1 pTicks = 0 end if end if sprite(95).locH = -500 sprite(94).locH = 3 sprite(85).member = "graydot" sprite(85).locH = -500 pieceNum = goContinueComputerMove() if pieceNum > 0 then sound(3).play(member("s_mouseDown")) goTransitionBoard(pieceNum, 1) goSetPiece(pieceNum, 1) setGameState(#player1Done) playFlashAnimationPair(gAniPairRed, 13, 14, gSoundEnabled) pTicks = 0 end if else if gGameState = #player1Done then setGameState(#player2Move) else if gGameState = #player2Move then if goNumPossibleMoves(2) = 0 then if goNumPossibleMoves(1) = 0 then setGameState(#Endgame) else setGameState(#player2Passing) end if else if gComputerPlayer[2] then goStartComputerMove(2) setGameState(#waitingComputer2) else gHumanMove = 0 setGameState(#waitingHuman2) end if end if else if gGameState = #waitingHuman2 then sprite(9).locH = 295 if pBlink = 1 then sprite(9).locH = 295 pTicks = pTicks + 1 if pTicks = 6 then pBlink = 0 pTicks = 0 end if else sprite(9).locH = -100 pTicks = pTicks + 1 if pTicks = 3 then pBlink = 1 pTicks = 0 end if end if sprite(94).locH = -500 sprite(95).locH = 308 if gHumanMove > 0 then if goCheckValidMove(gHumanMove, 2) then sound(3).play(member("s_mouseOver")) x = goTransitionBoard(gHumanMove, 2) newPoints = x * gPoints y = getScore() + newPoints setScore(y) if goIsStar(gHumanMove) then sprite(85).member = "xplode" sprite(85).loc = gMouseOn moleShowScoreBubble(gMouseOn.locH, gMouseOn.locV, gBonus) sound(2).play(member("ATTTONES")) y = getScore() + gBonus setScore(y) end if goSetPiece(gHumanMove, 2) setGameState(#player2Done) playFlashAnimationPair(gAniPairBlue, 14, 13, gSoundEnabled) pTicks = 0 else if gDidntCount < 3 then playFlashAnimationOne("didnt", 14, gSoundEnabled) gDidntCount = gDidntCount + 1 end if setGameState(#player2BadMove) end if else if (gBlueBored < 1) and (yawned = 1) then playFlashAnimationOne("bored", 14, gSoundEnabled) gBlueBored = gBlueBored + 1 end if end if else if gGameState = #waitingComputer2 then sprite(9).locH = 295 pieceNum = goContinueComputerMove() if pieceNum > 0 then goTransitionBoard(pieceNum, 2) goSetPiece(pieceNum, 2) setGameState(#player2Done) end if else if gGameState = #player2Done then setGameState(#player1Move) else if gGameState = #Endgame then case pEndOfGame of 1: if goGetNumPieces(2) >= goGetNumPieces(1) then sound(3).play(member("tada")) pEndOfGame = 2 else sound(3).play(member("buzzer")) pEndOfGame = 3 end if 2: if soundBusy(3) then go(the frame) else playFlashAnimationPair(gAniPairWon, 14, 13, gSoundEnabled) setGameState(#gameOver) pEndOfGame = 4 end if 3: if soundBusy(3) then go(the frame) else playFlashAnimationPair(gAniPairLost, 14, 13, gSoundEnabled) setGameState(#gameOver) pEndOfGame = 4 end if end case end if end if end if end if end if end if end if end if end if end if numP1 = goGetNumPieces(1) if numP1 <> gScorePlayer1 then gScorePlayer1 = numP1 member("t_Score1").text = string(gScorePlayer1) end if numP2 = goGetNumPieces(2) if numP2 <> gScorePlayer2 then gScorePlayer2 = numP2 member("t_Score2").text = string(gScorePlayer2) end if if the shiftDown = 1 then theKey = the keyPressed if (theKey <> EMPTY) and (gOldKey = EMPTY) then case theKey of "x": gCheater = 1 setGameState(#Endgame) "!": playFlashAnimationPair(gAniPairBlue, 14, 13, 1, 1) "@": playFlashAnimationPair(gAniPairWon, 14, 13, 1) "#": playFlashAnimationPair(gAniPairLost, 14, 13, 1) "$": playFlashAnimationOne("bored", 14, 1) "%": playFlashAnimationOne("didnt", 14, 1) "^": playFlashAnimationPair(gAniPairRed, 13, 14, 1, 1) end case end if gOldKey = theKey end if end on exitFrame if gGameState = #gameOver then num1Pieces = goGetNumPieces(1) num2Pieces = goGetNumPieces(2) numTotalPieces = num1Pieces + num2Pieces if num2Pieces >= num1Pieces then if num1Pieces = 0 then gameError("YOU SKUNKED 'EM!" & RETURN & RETURN & "Click to play" & RETURN & "the next round.") else if numTotalPieces = NUM_SQUARES then gameError("YOU WON!" & RETURN & RETURN & "Click to play" & RETURN & "the next round.") else gameError("YOU WON!" & RETURN & RETURN & "There are no more possible moves for either player. Click to play the next round.") end if end if gPlayerWon = 1 if pSetNextLevel = 1 then setNewLevel() pSetNextLevel = 0 end if go(the frame) else if num2Pieces = 0 then gameError("YOU GOT SKUNKED..." & RETURN & RETURN & "Why not play again?") else if numTotalPieces = NUM_SQUARES then gameError("YOU LOST..." & RETURN & RETURN & "Why not play again?") else gameError("YOU LOST..." & RETURN & RETURN & "There are no more possible moves for either player. Why not play again?") end if end if gPlayerWon = 0 go(the frame) end if else if gGameState = #player1BadMove then gameErrorBig("INVALID MOVE" & RETURN & RETURN & "You can only place your red Frendz on a square that causes one or more of the blue Frendz to be surrounded - either horizontally, vertically, or diagonally.") go(the frame) else if gGameState = #player2BadMove then gameErrorBig("INVALID MOVE" & RETURN & RETURN & "You can only place your blue Frendz on a square that causes one or more of the computer's red Frendz to be surrounded - either horizontally, vertically, or diagonally.") go(the frame) else if gGameState = #player1Passing then gameError("WELL DONE!" & RETURN & RETURN & "The Computer has no moves." & RETURN & RETURN & "It's your turn again.") go(the frame) else if gGameState = #player2Passing then gameError("OOPS!" & RETURN & RETURN & "You have no moves." & RETURN & RETURN & "It's the computer's turn again.") go(the frame) else go(the frame) end if end if end if end if end if end on setNewLevel case gStartLevel of "Easy": if gLevel = 2 then gDifficulity = "Medium" gPoints = 250 gBonus = 2500 else if gLevel = 4 then gDifficulity = "Hard" gPoints = 500 gBonus = 5000 else if gLevel = 6 then gDifficulity = "Harder" gPoints = 750 gBonus = 7500 else if gLevel > 8 then gDifficulity = "Hardest" gPoints = 1000 gBonus = 10000 end if end if end if end if "Medium": if gLevel = 2 then gDifficulity = "Hard" gPoints = 500 gBonus = 5000 else if gLevel = 4 then gDifficulity = "Harder" gPoints = 750 gBonus = 7500 else if gLevel > 6 then gDifficulity = "Hardest" gPoints = 1000 gBonus = 10000 end if end if end if "Hard": if gLevel = 2 then gDifficulity = "Harder" gPoints = 750 gBonus = 7500 else if gLevel > 4 then gDifficulity = "Hardest" gPoints = 1000 gBonus = 10000 end if end if end case gLevel = gLevel + 1 end