home *** CD-ROM | disk | FTP | other *** search
- property pSpaceStart, pSpace, pEnter, pConfusing, pEnterStart, pEneTimeStart, pEneTimeStart2, pSeed, pGettingSickOfUsingTimersForEverything
- global gCurrentLevel, gSelectedSprite, gBombList, gPlayer1, gPlayer2, gPlayer3, gEnemy1, gEnemy2, gEnemy3, gPath, gInfluence, gTotalHealth, gTotalScore
-
- on new
- pGettingSickOfUsingTimersForEverything = the ticks
- pEneTimeStart = the ticks
- pEneTimeStart2 = the ticks
- pSpace = 0
- pConfusing = 0
- gBombList = []
- gSelectedSprite = 0
- sprite(16).blend = 0
- gCurrentLevel = gCurrentLevel + 1
- newLevel(gCurrentLevel)
- gPlayer1 = new(script("AntScript"), 1, 2, 3, 20, 410, "sprite1", 50)
- gPlayer2 = new(script("AntScript"), 1, 2, 3, 60, 410, "sprite1", 51)
- gPlayer3 = new(script("AntScript"), 1, 2, 3, 140, 410, "sprite1", 52)
- gEnemy1 = new(script("AntScript"), 1, 2, 3, 250, 50, "sprite2", 54)
- gEnemy2 = new(script("AntScript"), 1, 2, 3, 320, 30, "sprite2", 55)
- gEnemy3 = new(script("AntScript"), 1, 2, 3, 180, 50, "sprite2", 56)
- gSelectedSprite = 52
- gPlayer3.setAntSelected()
- pathFind(gPlayer3.getAntPositionX() / 22, gPlayer3.getAntPositionY() / 22, 10, 16)
- gPlayer3.setDaPath(gPath)
- aTimer = the ticks
- counter = 0
- repeat while counter < 50
- if (aTimer + 1) < the ticks then
- counter = counter + 1
- aTimer = the ticks
- gPlayer3.updateAnt()
- updateStage()
- end if
- end repeat
- doTitle()
- end
-
- on exitFrame me
- doInput()
- repeat with counter = 1 to count(gBombList)
- gBombList[counter].updateBomb()
- end repeat
- gEnemy1.updateAnt()
- gEnemy2.updateAnt()
- gEnemy3.updateAnt()
- doEnemyIntelligence()
- go(the frame)
- end
-
- on doInput
- if (keyPressed(RETURN) = 1) and (pConfusing = 0) then
- getNextSprite()
- pConfusing = 1
- end if
- if (keyPressed(RETURN) = 0) and (pConfusing = 1) then
- pConfusing = 0
- end if
- if keyPressed(126) and keyPressed(123) then
- case gSelectedSprite of
- 50:
- gPlayer1.setAntDirection(8)
- gPlayer1.moveAnt()
- 51:
- gPlayer2.setAntDirection(8)
- gPlayer2.moveAnt()
- 52:
- gPlayer3.setAntDirection(8)
- gPlayer3.moveAnt()
- end case
- else
- if keyPressed(126) and keyPressed(124) then
- case gSelectedSprite of
- 50:
- gPlayer1.setAntDirection(2)
- gPlayer1.moveAnt()
- 51:
- gPlayer2.setAntDirection(2)
- gPlayer2.moveAnt()
- 52:
- gPlayer3.setAntDirection(2)
- gPlayer3.moveAnt()
- end case
- else
- if keyPressed(125) and keyPressed(123) then
- case gSelectedSprite of
- 50:
- gPlayer1.setAntDirection(6)
- gPlayer1.moveAnt()
- 51:
- gPlayer2.setAntDirection(6)
- gPlayer2.moveAnt()
- 52:
- gPlayer3.setAntDirection(6)
- gPlayer3.moveAnt()
- end case
- else
- if keyPressed(125) and keyPressed(124) then
- case gSelectedSprite of
- 50:
- gPlayer1.setAntDirection(4)
- gPlayer1.moveAnt()
- 51:
- gPlayer2.setAntDirection(4)
- gPlayer2.moveAnt()
- 52:
- gPlayer3.setAntDirection(4)
- gPlayer3.moveAnt()
- end case
- else
- if keyPressed(123) then
- case gSelectedSprite of
- 50:
- gPlayer1.setAntDirection(7)
- gPlayer1.moveAnt()
- 51:
- gPlayer2.setAntDirection(7)
- gPlayer2.moveAnt()
- 52:
- gPlayer3.setAntDirection(7)
- gPlayer3.moveAnt()
- end case
- else
- if keyPressed(124) then
- case gSelectedSprite of
- 50:
- gPlayer1.setAntDirection(3)
- gPlayer1.moveAnt()
- 51:
- gPlayer2.setAntDirection(3)
- gPlayer2.moveAnt()
- 52:
- gPlayer3.setAntDirection(3)
- gPlayer3.moveAnt()
- end case
- else
- if keyPressed(126) then
- case gSelectedSprite of
- 50:
- gPlayer1.setAntDirection(1)
- gPlayer1.moveAnt()
- 51:
- gPlayer2.setAntDirection(1)
- gPlayer2.moveAnt()
- 52:
- gPlayer3.setAntDirection(1)
- gPlayer3.moveAnt()
- end case
- else
- if keyPressed(125) then
- case gSelectedSprite of
- 50:
- gPlayer1.setAntDirection(5)
- gPlayer1.moveAnt()
- 51:
- gPlayer2.setAntDirection(5)
- gPlayer2.moveAnt()
- 52:
- gPlayer3.setAntDirection(5)
- gPlayer3.moveAnt()
- end case
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- if (the mouseDown = 1) and (pSpace = 0) and ((pGettingSickOfUsingTimersForEverything + 20) < the ticks) then
- pGettingSickOfUsingTimersForEverything = the ticks
- pSpace = 1
- pSpaceStart = the ticks
- case gSelectedSprite of
- 50:
- gPlayer1.setReadyTaLaunch()
- 51:
- gPlayer2.setReadyTaLaunch()
- 52:
- gPlayer3.setReadyTaLaunch()
- end case
- end if
- if the mouseDown = 1 then
- holdTime = (the ticks - pSpaceStart) / 3
- if holdTime > 15 then
- holdTime = 15
- end if
- sprite(12).width = holdTime * 121 / 15
- end if
- if (the mouseDown = 0) and (pSpace = 1) then
- sprite(12).width = 2
- if not (gSelectedSprite = 0) then
- pSpace = 0
- holdTime = (the ticks - pSpaceStart) / 3
- if holdTime > 15 then
- holdTime = 15
- end if
- if holdTime < 4 then
- holdTime = 4
- end if
- case gSelectedSprite of
- 50:
- gPlayer1.startBombThrow(1, holdTime * 20)
- 51:
- gPlayer2.startBombThrow(1, holdTime * 20)
- 52:
- gPlayer3.startBombThrow(1, holdTime * 20)
- end case
- end if
- end if
- if (the rightMouseDown = 1) and (pEnter = 0) and ((pGettingSickOfUsingTimersForEverything + 20) < the ticks) then
- pGettingSickOfUsingTimersForEverything = the ticks
- pEnter = 1
- pEnterStart = the ticks
- case gSelectedSprite of
- 50:
- gPlayer1.setReadyTaLaunch()
- 51:
- gPlayer2.setReadyTaLaunch()
- 52:
- gPlayer3.setReadyTaLaunch()
- end case
- end if
- if the rightMouseDown = 1 then
- holdTime = (the ticks - pEnterStart) / 3
- if holdTime > 15 then
- holdTime = 15
- end if
- sprite(12).width = holdTime * 121 / 15
- end if
- if (the rightMouseDown = 0) and (pEnter = 1) then
- sprite(12).width = 2
- if not (gSelectedSprite = 0) then
- pEnter = 0
- holdTime = (the ticks - pEnterStart) / 3
- if holdTime > 15 then
- holdTime = 15
- end if
- if holdTime < 4 then
- holdTime = 4
- end if
- case gSelectedSprite of
- 50:
- gPlayer1.startBombThrow(2, holdTime * 20)
- 51:
- gPlayer2.startBombThrow(2, holdTime * 20)
- 52:
- gPlayer3.startBombThrow(2, holdTime * 20)
- end case
- end if
- end if
- end
-
- on newLevel theLevel
- gTotalHealth = 150
- member("HealthDisplay").text = string(gTotalHealth)
- member("Alpha1").image = member("Alpha1Copy").image
- member("FortAlpha").image = member("FortAlphaCopy").image
- case theLevel of
- 1:
- sprite(7).member = "Alpha1"
- sprite(5).member = "Background1"
- pSeed = 3
- sprite(281).visible = 0
- sprite(282).visible = 0
- 2:
- pSeed = 2
- sprite(7).member = "Alpha1"
- sprite(5).member = "Background1"
- sprite(281).visible = 0
- sprite(282).visible = 0
- 3:
- pSeed = 1
- sprite(7).member = "Alpha1"
- sprite(5).member = "Background1"
- sprite(281).visible = 0
- sprite(282).visible = 0
- 4:
- sprite(7).member = "Alpha1"
- sprite(5).member = "Background1"
- sprite(281).visible = 0
- sprite(282).visible = 0
- end case
- end
-
- on doEnemyIntelligence
- if (gPlayer1.pState = 3) and (gPlayer2.pState = 3) and (gPlayer3.pState = 3) then
- exit
- end if
- if (pEneTimeStart2 + 10) < the ticks then
- pEneTimeStart2 = the ticks
- allHiding = 1
- if not ((gPlayer1.pPositionX < 115) and (gPlayer1.pPositionY > 395)) and not (gPlayer1.pState = 3) then
- allHiding = 0
- else
- if not ((gPlayer2.pPositionX < 115) and (gPlayer2.pPositionY > 395)) and not (gPlayer2.pState = 3) then
- allHiding = 0
- else
- if not ((gPlayer3.pPositionX < 115) and (gPlayer3.pPositionY > 395)) and not (gPlayer3.pState = 3) then
- allHiding = 0
- end if
- end if
- end if
- if not (gEnemy1.pState = 3) and (random(pSeed) = 1) then
- curX = gEnemy1.pPositionX
- curY = gEnemy1.pPositionY
- if gPlayer1.pState = 3 then
- distance1 = 1200
- else
- if (allHiding = 0) and ((gPlayer1.pPositionX < 115) and (gPlayer1.pPositionY > 395)) then
- distance1 = 1200
- else
- distance1 = sqrt(((gPlayer1.pPositionX - curX) * (gPlayer1.pPositionX - curX)) + ((gPlayer1.pPositionY - curY) * (gPlayer1.pPositionY - curY)))
- end if
- end if
- if gPlayer2.pState = 3 then
- distance2 = 1200
- else
- if (allHiding = 0) and ((gPlayer2.pPositionX < 115) and (gPlayer2.pPositionY > 395)) then
- distance2 = 1200
- else
- distance2 = sqrt(((gPlayer2.pPositionX - curX) * (gPlayer2.pPositionX - curX)) + ((gPlayer2.pPositionY - curY) * (gPlayer2.pPositionY - curY)))
- end if
- end if
- if gPlayer3.pState = 3 then
- distance3 = 1200
- else
- if (allHiding = 0) and ((gPlayer3.pPositionX < 115) and (gPlayer3.pPositionY > 395)) then
- distance3 = 1200
- else
- distance3 = sqrt(((gPlayer3.pPositionX - curX) * (gPlayer3.pPositionX - curX)) + ((gPlayer3.pPositionY - curY) * (gPlayer3.pPositionY - curY)))
- end if
- end if
- if (distance1 < distance2) and (distance1 < distance3) and (distance1 < 300) then
- gEnemy1.EnemyShot(gPlayer1.pPositionX, gPlayer1.pPositionY, distance1)
- else
- if (distance2 < distance1) and (distance2 < distance3) and (distance2 < 300) then
- gEnemy1.EnemyShot(gPlayer2.pPositionX, gPlayer2.pPositionY, distance2)
- else
- if distance3 < 300 then
- gEnemy1.EnemyShot(gPlayer3.pPositionX, gPlayer3.pPositionY, distance3)
- end if
- end if
- end if
- end if
- if not (gEnemy2.pState = 3) and (random(pSeed) = 1) then
- curX = gEnemy2.pPositionX
- curY = gEnemy2.pPositionY
- if gPlayer1.pState = 3 then
- distance1 = 1200
- else
- if (allHiding = 0) and ((gPlayer1.pPositionX < 115) and (gPlayer1.pPositionY > 395)) then
- distance1 = 1200
- else
- distance1 = sqrt(((gPlayer1.pPositionX - curX) * (gPlayer1.pPositionX - curX)) + ((gPlayer1.pPositionY - curY) * (gPlayer1.pPositionY - curY)))
- end if
- end if
- if gPlayer2.pState = 3 then
- distance2 = 1200
- else
- if (allHiding = 0) and ((gPlayer2.pPositionX < 115) and (gPlayer2.pPositionY > 395)) then
- distance2 = 1200
- else
- distance2 = sqrt(((gPlayer2.pPositionX - curX) * (gPlayer2.pPositionX - curX)) + ((gPlayer2.pPositionY - curY) * (gPlayer2.pPositionY - curY)))
- end if
- end if
- if gPlayer3.pState = 3 then
- distance3 = 1200
- else
- if (allHiding = 0) and ((gPlayer3.pPositionX < 115) and (gPlayer3.pPositionY > 395)) then
- distance3 = 1200
- else
- distance3 = sqrt(((gPlayer3.pPositionX - curX) * (gPlayer3.pPositionX - curX)) + ((gPlayer3.pPositionY - curY) * (gPlayer3.pPositionY - curY)))
- end if
- end if
- if (distance1 < distance2) and (distance1 < distance3) and (distance1 < 300) then
- gEnemy2.EnemyShot(gPlayer1.pPositionX, gPlayer1.pPositionY, distance1)
- else
- if (distance2 < distance1) and (distance2 < distance3) and (distance2 < 300) then
- gEnemy2.EnemyShot(gPlayer2.pPositionX, gPlayer2.pPositionY, distance2)
- else
- if distance3 < 300 then
- gEnemy2.EnemyShot(gPlayer3.pPositionX, gPlayer3.pPositionY, distance3)
- end if
- end if
- end if
- end if
- if not (gEnemy3.pState = 3) and (random(pSeed) = 1) then
- curX = gEnemy3.pPositionX
- curY = gEnemy3.pPositionY
- if gPlayer1.pState = 3 then
- distance1 = 1200
- else
- distance1 = sqrt(((gPlayer1.pPositionX - curX) * (gPlayer1.pPositionX - curX)) + ((gPlayer1.pPositionY - curY) * (gPlayer1.pPositionY - curY)))
- end if
- if gPlayer2.pState = 3 then
- distance2 = 1200
- else
- distance2 = sqrt(((gPlayer2.pPositionX - curX) * (gPlayer2.pPositionX - curX)) + ((gPlayer2.pPositionY - curY) * (gPlayer2.pPositionY - curY)))
- end if
- if gPlayer3.pState = 3 then
- distance3 = 1200
- else
- distance3 = sqrt(((gPlayer3.pPositionX - curX) * (gPlayer3.pPositionX - curX)) + ((gPlayer3.pPositionY - curY) * (gPlayer3.pPositionY - curY)))
- end if
- if (distance1 < distance2) and (distance1 < distance3) and (distance1 < 300) then
- gEnemy3.EnemyShot(gPlayer1.pPositionX, gPlayer1.pPositionY, distance1)
- else
- if (distance2 < distance1) and (distance2 < distance3) and (distance2 < 300) then
- gEnemy3.EnemyShot(gPlayer2.pPositionX, gPlayer2.pPositionY, distance2)
- else
- if distance3 < 300 then
- gEnemy3.EnemyShot(gPlayer3.pPositionX, gPlayer3.pPositionY, distance3)
- end if
- end if
- end if
- end if
- end if
- if (pEneTimeStart + 120) < the ticks then
- pEneTimeStart = the ticks
- if not (gEnemy1.pState = 3) then
- if gEnemy1.pPray = 0 then
- found = 0
- repeat while found = 0
- thePray = random(3)
- case thePray of
- 1:
- if not (gPlayer1.pState = 3) then
- gEnemy1.pPray = 1
- found = 1
- end if
- 2:
- if not (gPlayer2.pState = 3) then
- gEnemy1.pPray = 2
- found = 1
- end if
- 3:
- if not (gPlayer3.pState = 3) then
- gEnemy1.pPray = 3
- found = 1
- end if
- end case
- end repeat
- end if
- case gEnemy1.pPray of
- 1:
- if gPlayer1.pState = 3 then
- gEnemy1.pPray = 0
- end if
- 2:
- if gPlayer2.pState = 3 then
- gEnemy1.pPray = 0
- end if
- 3:
- if gPlayer3.pState = 3 then
- gEnemy1.pPray = 0
- end if
- end case
- findNewPos(gEnemy1.pPositionX, gEnemy1.pPositionY, gEnemy1.pPray, 1)
- end if
- if not (gEnemy2.pState = 3) then
- if gEnemy2.pPray = 0 then
- found = 0
- repeat while found = 0
- thePray = random(3)
- case thePray of
- 1:
- if not (gPlayer1.pState = 3) then
- gEnemy2.pPray = 1
- found = 1
- end if
- 2:
- if not (gPlayer2.pState = 3) then
- gEnemy2.pPray = 2
- found = 1
- end if
- 3:
- if not (gPlayer3.pState = 3) then
- gEnemy2.pPray = 3
- found = 1
- end if
- end case
- end repeat
- end if
- case gEnemy2.pPray of
- 1:
- if gPlayer1.pState = 3 then
- gEnemy2.pPray = 0
- end if
- 2:
- if gPlayer2.pState = 3 then
- gEnemy2.pPray = 0
- end if
- 3:
- if gPlayer3.pState = 3 then
- gEnemy2.pPray = 0
- end if
- end case
- findNewPos(gEnemy2.pPositionX, gEnemy2.pPositionY, gEnemy2.pPray, 2)
- end if
- end if
- end
-
- on findNewPos curX, curY, thePray, refToEnemy
- case thePray of
- 1:
- aX = gPlayer1.pPositionX
- aY = gPlayer1.pPositionY
- 2:
- aX = gPlayer2.pPositionX
- aY = gPlayer2.pPositionY
- 3:
- aX = gPlayer3.pPositionX
- aY = gPlayer3.pPositionY
- end case
- theDistance = sqrt(((aX - curX) * (aX - curX)) + ((aY - curY) * (aY - curY)))
- if (theDistance <= 200) and (theDistance >= 80) then
- exit
- end if
- found = 0
- fcounter = 0
- repeat while found = 0
- fcounter = fcounter + 1
- if fcounter > 10 then
- exit repeat
- end if
- curX = random(420)
- curY = random(420)
- theDistance = sqrt(((aX - curX) * (aX - curX)) + ((aY - curY) * (aY - curY)))
- if (theDistance <= 200) and (theDistance >= 80) then
- found = 1
- case refToEnemy of
- 1:
- pathFind(gEnemy1.getAntPositionX() / 22, gEnemy1.getAntPositionY() / 22, curX / 22, curY / 22)
- gEnemy1.setDaPath(gPath)
- 2:
- pathFind(gEnemy2.getAntPositionX() / 22, gEnemy2.getAntPositionY() / 22, curX / 22, curY / 22)
- gEnemy2.setDaPath(gPath)
- 3:
- pathFind(gEnemy3.getAntPositionX() / 22, gEnemy3.getAntPositionY() / 22, curX / 22, curY / 22)
- gEnemy3.setDaPath(gPath)
- end case
- end if
- end repeat
- end
-
- on doTitle
- sprite(285).puppet = 1
- sprite(285).member = "title10"
- sprite(285).loc = point(290, 220)
- sprite(285).blend = 0
- aTimer = the ticks
- repeat while sprite(285).blend <= 80
- if (aTimer + 2) < the ticks then
- aTimer = the ticks
- sprite(285).blend = sprite(285).blend + 20
- updateStage()
- end if
- end repeat
- sprite(285).blend = 100
- aTimer = the ticks
- repeat while (aTimer + 60) > the ticks
- end repeat
- aTimer = the ticks
- repeat while sprite(285).blend >= 20
- if (aTimer + 2) < the ticks then
- aTimer = the ticks
- sprite(285).blend = sprite(285).blend - 20
- updateStage()
- end if
- end repeat
- sprite(285).blend = 0
- sprite(285).puppet = 0
- end
-