home *** CD-ROM | disk | FTP | other *** search
- global gCurrentLevel, gTotalScore, gTheMouseDownSprite, gBombList, gPlayer1, gPlayer2, gPlayer3, gEnemy1, gEnemy2, gEnemy3, pCheezeHasBeenMoved, gThePad, gPath, gTotalHealth, gFlagSeised, pThePoint, gPathNetwork, gPointPositions, doChopper
-
- on prepareMovie me
- doChopper = 0
- gPointPositions = [point(264, 400), point(414, 331), point(517, 403), point(110, 404), point(33, 196), point(192, 77), point(493, 91)]
- pointList = [point(264, 400), point(414, 331)]
- gPathNetwork = [new(script("Path"), pointList, pointList[1], pointList[2], 1, 2)]
- pointList = [point(414, 331), point(425, 335), point(499, 374), point(509, 383), point(513, 393), point(517, 403)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[6], 2, 3))
- pointList = [point(414, 331), point(413, 314), point(408, 304), point(368, 211), point(369, 190), point(368, 178), point(367, 168), point(359, 157), point(341, 150), point(307, 139), point(204, 89), point(192, 77)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[12], 2, 6))
- pointList = [point(192, 77), point(205, 75), point(277, 109), point(370, 137), point(379, 137), point(393, 135), point(405, 131), point(493, 91)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[8], 6, 7))
- pointList = [point(192, 77), point(186, 86), point(246, 139), point(252, 152), point(251, 166), point(118, 399), point(110, 404)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[7], 6, 4))
- pointList = [point(110, 404), point(264, 400)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[2], 4, 1))
- pointList = [point(110, 404), point(101, 404), point(88, 396), point(21, 292), point(18, 276), point(14, 259), point(19, 244), point(26, 233), point(37, 222), point(37, 211), point(33, 196)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[11], 4, 5))
- pointList = [point(192, 77), point(33, 196)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[2], 6, 5))
- pointList = [point(33, 196), point(20, 168), point(16, 159), point(11, 83), point(10, 62), point(13, 45), point(21, 28), point(45, 21), point(65, 21), point(83, 24), point(185, 61), point(192, 77)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[12], 5, 6))
- pointList = [point(517, 403), point(493, 91)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[2], 3, 7))
- pointList = [point(192, 77), point(493, 91)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[2], 6, 7))
- pointList = [point(264, 400), point(286, 317), point(290, 300), point(294, 288), point(303, 266), point(307, 248), point(304, 227), point(299, 211), point(290, 194), point(281, 180), point(273, 171), point(192, 77)]
- append(gPathNetwork, new(script("Path"), pointList, pointList[1], pointList[12], 1, 6))
- gTotalHealth = 0
- gTotalScore = 0
- gCurrentLevel = 0
- gTotalScore = 0
- end
-
- on displayScore
- member("ScoreDisplay").text = string(gTotalScore)
- end
-
- on displayLevel
- member("LevelDisplay").text = string(gCurrentLevel)
- end
-
- on checkIfNodeThere theNode
- there = 0
- repeat with counter = 1 to count(gPath)
- if gPath[counter] = theNode then
- there = 1
- end if
- end repeat
- return there
- end
-
- on getNextSprite
- gPlayer1.setAntDeSelected()
- gPlayer2.setAntDeSelected()
- gPlayer3.setAntDeSelected()
- gSelectedSprite = gSelectedSprite + 1
- if gSelectedSprite > 52 then
- gSelectedSprite = 50
- end if
- case gSelectedSprite of
- 50:
- if gPlayer1.pState = 3 then
- getNextSprite()
- exit
- end if
- 51:
- if gPlayer2.pState = 3 then
- getNextSprite()
- exit
- end if
- 52:
- if gPlayer3.pState = 3 then
- getNextSprite()
- exit
- end if
- end case
- case gSelectedSprite of
- 50:
- gPlayer1.setAntSelected()
- 51:
- gPlayer2.setAntSelected()
- 52:
- gPlayer3.setAntSelected()
- otherwise:
- sprite(16).blend = 0
- gSelectedSprite = 0
- end case
- sprite(16).loc = sprite(gSelectedSprite).loc
- end
-
- on makeSpriteFlash spriteNumber
- if sprite(spriteNumber).blend = 100 then
- sprite(spriteNumber).blend = 0
- return 0
- else
- sprite(spriteNumber).blend = 100
- return 1
- end if
- end
-
- on getAngle x1, y1, x2, y2
- loc1 = [x1, y1]
- loc2 = [x2, y2]
- deltaX = loc2[1] - loc1[1]
- deltaY = -1 * (loc2[2] - loc1[2])
- if deltaY = 0 then
- if deltaX > 0 then
- return 0
- end if
- if deltaX < 0 then
- return 180
- end if
- end if
- if deltaX = 0 then
- deltaX = 0.01
- end if
- theAngle = atan(float(deltaY) / float(deltaX))
- theAngle = theAngle * 180 / PI
- if (deltaX < 0) and (deltaY > 0) then
- theAngle = 180 + theAngle
- else
- if (deltaX < 0) and (deltaY < 0) then
- theAngle = 180 + theAngle
- else
- if (deltaX > 0) and (deltaY < 0) then
- theAngle = 360 + theAngle
- end if
- end if
- end if
- theAngle = theAngle - 90
- if theAngle < 0 then
- theAngle = 360 + theAngle
- end if
- return theAngle
- end
-
- on getDistance point1X, point1Y, point2X, point2Y
- distance1 = float(abs(point1X - point2X))
- distance2 = float(abs(point1Y - point2Y))
- hypo = sqrt((distance1 * distance1) + (distance2 * distance2))
- return hypo
- end
-
- on getTrackDistance listOfPoint
- theDistance = 0.0
- repeat with counter = 1 to count(listOfPoint) - 1
- theDistance = theDistance + getDistance(listOfPoint[counter][1], listOfPoint[counter][2], listOfPoint[counter + 1][1], listOfPoint[counter + 1][2])
- end repeat
- theDistance = theDistance + getDistance(listOfPoint[1][1], listOfPoint[1][2], listOfPoint[count(listOfPoint)][1], listOfPoint[count(listOfPoint)][2])
- return theDistance
- end
-
- on getIdealAveragePoint point1, point2, point3, point4
- centerX = 0.5
- centerY = 0.5
- x = (float(point1[1]) * ((-0.5 * centerX * centerX * centerX) + (centerX * centerX) - (0.5 * centerX))) + (float(point2[1]) * ((1.5 * centerX * centerX * centerX) - (2.5 * centerX * centerX) + 1.0)) + (float(point3[1]) * ((-1.5 * centerX * centerX * centerX) + (2.0 * centerX * centerX) + (0.5 * centerX))) + (float(point4[1]) * ((0.5 * centerX * centerX * centerX) - (0.5 * centerX * centerX)))
- y = (float(point1[2]) * ((-0.5 * centerY * centerY * centerY) + (centerY * centerY) - (0.5 * centerY))) + (float(point2[2]) * ((1.5 * centerY * centerY * centerY) - (2.5 * centerY * centerY) + 1.0)) + (float(point3[2]) * ((-1.5 * centerY * centerY * centerY) + (2.0 * centerY * centerY) + (0.5 * centerY))) + (float(point4[2]) * ((0.5 * centerY * centerY * centerY) - (0.5 * centerY * centerY)))
- thePoint = point(x, y)
- return thePoint
- end
-
- on idealPath thePath
- if count(thePath) <= 2 then
- return duplicate(thePath)
- end if
- newPoints = []
- if count(thePath) = 3 then
- addAt(thePath, 2, getIdealAveragePoint(thePath[1], thePath[1], thePath[2], thePath[3]))
- addAt(thePath, 4, getIdealAveragePoint(thePath[1], thePath[3], thePath[4], thePath[4]))
- else
- addAt(newPoints, 1, getIdealAveragePoint(thePath[1], thePath[1], thePath[2], thePath[3]))
- repeat with counter = 2 to count(thePath) - 2
- addAt(newPoints, counter, getIdealAveragePoint(thePath[counter - 1], thePath[counter], thePath[counter + 1], thePath[counter + 2]))
- end repeat
- addAt(newPoints, count(thePath) - 1, getIdealAveragePoint(thePath[count(thePath) - 2], thePath[count(thePath) - 1], thePath[count(thePath)], thePath[count(thePath)]))
- counter2 = 2
- repeat with counter = 1 to count(newPoints)
- addAt(thePath, counter2, newPoints[counter])
- counter2 = counter2 + 2
- end repeat
- end if
- return duplicate(thePath)
- end
-
- on spriteColision spriteRect, objectSpriteNum
- colRect = intersect(spriteRect, sprite(objectSpriteNum).rect)
- if colRect = rect(0, 0, 0, 0) then
- return 0
- end if
- x1 = colRect.left - sprite(objectSpriteNum).rect.left
- x2 = colRect.right - sprite(objectSpriteNum).rect.left
- y1 = colRect.top - sprite(objectSpriteNum).rect.top
- y2 = colRect.bottom - sprite(objectSpriteNum).rect.top
- repeat with x = x1 to x2
- x = x + 3
- theColor = sprite(objectSpriteNum).member.image.getPixel(x, y1)
- if theColor = rgb(248, 0, 0) then
- return 2
- next repeat
- end if
- if theColor = rgb(0, 248, 0) then
- return 1
- end if
- end repeat
- repeat with x = x1 to x2
- x = x + 3
- theColor = sprite(objectSpriteNum).member.image.getPixel(x, y1)
- if theColor = rgb(248, 0, 0) then
- return 2
- next repeat
- end if
- if theColor = rgb(0, 248, 0) then
- return 1
- end if
- end repeat
- repeat with y = y1 to y2
- y = y + 3
- theColor = sprite(objectSpriteNum).member.image.getPixel(x, y1)
- if theColor = rgb(248, 0, 0) then
- return 2
- next repeat
- end if
- if theColor = rgb(0, 248, 0) then
- return 1
- end if
- end repeat
- repeat with y = y1 to y2
- y = y + 3
- theColor = sprite(objectSpriteNum).member.image.getPixel(x, y1)
- if theColor = rgb(248, 0, 0) then
- return 2
- next repeat
- end if
- if theColor = rgb(0, 248, 0) then
- return 1
- end if
- end repeat
- return 0
- end
-