home *** CD-ROM | disk | FTP | other *** search
Wrap
property pHoldingFlag, pAngle, pMovementSpeed, pPositionX, pPositionY, pSpriteName, pAntChannel, pCurrentPathReversed, pPointList, pDestPoint, pCurrentPath, pDestIDPoint, pObjectStopped, pDoWideTurn, pExpectedAngle, pEnemyShooting, pTarget, pEnergy, stundTime, pStund, pCannonAngle, pCannonChannel global gFlagSeised, gCurrentLevel, gPlayer3, gEnemy1, gEnemy2, gEnemy3, gBombList, gInfluence, gPathNetwork, gThePad on new me, antDirection, antSpeed, animationSpeed, posX, posY, spriteName, antChannel stundTime = 120 pState = 1 pEnergy = 120 pEnemyShooting = 0 pTarget = point(200, 200) pDoWideTurn = 0 pObjectStopped = 0 pHoldingFlag = 0 pDirection = antDirection pMovementSpeed = antSpeed pPositionX = posX pPositionY = posY pSpriteName = spriteName pAntChannel = antChannel case pAntChannel of 54: pDestIDPoint = 4 aPoint = 4 getNextPath(pDestIDPoint, aPoint) pDestPoint = 1 55: pDestIDPoint = 3 aPoint = 3 getNextPath(pDestIDPoint, aPoint) pDestPoint = 1 56: pDestIDPoint = 7 aPoint = 7 getNextPath(pDestIDPoint, aPoint) pDestPoint = 1 end case case pAntChannel of 54: pCannonChannel = 59 55: pCannonChannel = 60 56: pCannonChannel = 61 end case pDestPoint = 1 pAngle = getAngle(integer(pPositionX), integer(pPositionY), integer(pPointList[pDestPoint][1]), integer(pPointList[pDestPoint][2])) sprite(pAntChannel).rotation = 360 - pAngle pCannonAngle = pAngle sprite(pCannonChannel).rotation = 360 - pCannonAngle sprite(pAntChannel).loc = point(pPositionX, pPositionY) return me end on getAntChannel me return pAntChannel end on updateAnt me if stundTime < 120 then stundTime = stundTime + 1.5 if (stundTime > 100) and (stundTime < 110) then case pAntChannel of 54: sprite(69).loc = point(800, 800) 55: sprite(70).loc = point(800, 800) 56: sprite(71).loc = point(800, 800) end case end if exit end if if pEnergy < 120 then pEnergy = pEnergy + 3 end if if pEnergy >= 120 then if random(10) = 1 then if (gFlagSeised = 1) and (pHoldingFlag = 0) then if gPlayer3.pIsHoldingObject = 1 then pTarget = 1 else if gEnemy1.pHoldingFlag = 1 then pTarget = 2 else if gEnemy2.pHoldingFlag = 1 then pTarget = 3 else if gEnemy3.pHoldingFlag = 1 then pTarget = 4 end if end if end if end if doShooting() else shortestDistance = 100000 if (getDistance(gPlayer3.pPositionX, gPlayer3.pPositionY, pPositionX, pPositionY) < shortestDistance) and (gPlayer3.pState <> 6) then shortestDistance = getDistance(gPlayer3.pPositionX, gPlayer3.pPositionY, pPositionX, pPositionY) pTarget = 1 end if if (getDistance(gEnemy1.pPositionX, gEnemy1.pPositionY, pPositionX, pPositionY) < shortestDistance) and (pAntChannel <> 54) and (gEnemy1.stundTime >= 120) then shortestDistance = getDistance(gEnemy1.pPositionX, gEnemy1.pPositionY, pPositionX, pPositionY) pTarget = 2 end if if (getDistance(gEnemy2.pPositionX, gEnemy2.pPositionY, pPositionX, pPositionY) < shortestDistance) and (pAntChannel <> 55) and (gEnemy2.stundTime >= 120) then shortestDistance = getDistance(gEnemy2.pPositionX, gEnemy2.pPositionY, pPositionX, pPositionY) pTarget = 3 end if if (getDistance(gEnemy3.pPositionX, gEnemy3.pPositionY, pPositionX, pPositionY) < shortestDistance) and (pAntChannel <> 56) and (gEnemy3.stundTime >= 120) then shortestDistance = getDistance(gEnemy3.pPositionX, gEnemy3.pPositionY, pPositionX, pPositionY) pTarget = 4 end if if shortestDistance < 100000 then doShooting() end if end if end if end if if pEnemyShooting = 1 then continueShooting() end if if pDoWideTurn = 1 then doWideTurn() exit end if howDeep = spriteColision(sprite(pAntChannel).rect, 1) if howDeep = 2 then pMovementSpeed = 1 else if howDeep = 1 then pMovementSpeed = 3 else pMovementSpeed = 5 end if end if pPositionX = pPositionX - (float(sin(pAngle * 3.14000000000000012 / 180.0)) * pMovementSpeed) pPositionY = pPositionY - (float(cos(pAngle * 3.14000000000000012 / 180.0)) * pMovementSpeed) if pHoldingFlag = 1 then sprite(20).loc = point(pPositionX, pPositionY) end if if (pPositionX > (pPointList[pDestPoint][1] - 3)) and (pPositionX < (pPointList[pDestPoint][1] + 3)) and (pPositionY > (pPointList[pDestPoint][2] - 3)) and (pPositionY < (pPointList[pDestPoint][2] + 3)) then totalDestPoints = totalDestPoints + 1 pDestPoint = pDestPoint + 1 if pDestPoint > count(pPointList) then pDestPoint = 1 end if if (pDestPoint = 1) or (pDestPoint = count(pPointList)) then if pCurrentPathReversed then pDestIDPoint = gPathNetwork[pCurrentPath].pIDPoint1 else pDestIDPoint = gPathNetwork[pCurrentPath].pIDPoint2 end if doIntelligence() end if newAngle = getAngle(pPositionX, pPositionY, pPointList[pDestPoint][1], pPointList[pDestPoint][2]) difference = abs(pAngle - newAngle) if difference > 180 then difference = 360 - difference end if if difference > 50 then pDoWideTurn = 1 pExpectedAngle = newAngle doWideTurn() exit end if pAngle = newAngle sprite(pAntChannel).rotation = 360 - pAngle if pDestPoint = count(pPointList) then end if end if sprite(pAntChannel).loc = point(pPositionX, pPositionY) case pAntChannel of 54: sprite(59).loc = point(pPositionX + (float(sin(pAngle * 3.14000000000000012 / 180)) * 9), pPositionY + (float(cos(pAngle * 3.14000000000000012 / 180)) * 9)) 55: sprite(60).loc = point(pPositionX + (float(sin(pAngle * 3.14000000000000012 / 180)) * 9), pPositionY + (float(cos(pAngle * 3.14000000000000012 / 180)) * 9)) 56: sprite(61).loc = point(pPositionX + (float(sin(pAngle * 3.14000000000000012 / 180)) * 9), pPositionY + (float(cos(pAngle * 3.14000000000000012 / 180)) * 9)) end case end on setAntPosition me, posX, posY pPositionX = posX pPositionY = posY sprite(pAntChannel).locH = pPositionX sprite(pAntChannel).locV = pPositionY end on getNextPath currentIDPoint, finalDestination possiblePaths = [] repeat with counter = 1 to count(gPathNetwork) if (gPathNetwork[counter].pIDPoint1 = currentIDPoint) or (gPathNetwork[counter].pIDPoint2 = currentIDPoint) then append(possiblePaths, counter) end if end repeat shortestDistance = 100000 repeat with counter = 1 to count(possiblePaths) if gPathNetwork[possiblePaths[counter]].pIDPoint1 = currentIDPoint then destPoint = gPathNetwork[possiblePaths[counter]].pPoint2 else destPoint = gPathNetwork[possiblePaths[counter]].pPoint1 end if case finalDestination of 1: finalDestPoint = point(264, 400) 2: finalDestPoint = point(414, 331) 3: finalDestPoint = point(517, 403) 4: finalDestPoint = point(110, 404) 5: finalDestPoint = point(33, 196) 6: finalDestPoint = point(192, 77) 7: finalDestPoint = point(493, 91) end case newDistance = getDistance(finalDestPoint[1], finalDestPoint[2], destPoint[1], destPoint[2]) if newDistance < shortestDistance then shortestDistance = newDistance thePath = possiblePaths[counter] end if end repeat if gPathNetwork[thePath].pIDPoint1 = currentIDPoint then pCurrentPathReversed = 0 pCurrentPath = thePath pPointList = gPathNetwork[pCurrentPath].pNodeList else pCurrentPathReversed = 1 pCurrentPath = thePath pPointList = gPathNetwork[pCurrentPath].pNodeList tempPointList = duplicate(pPointList) pPointList = reversePath(tempPointList) end if end on doIntelligence if gFlagSeised = 0 then aPoint = 6 getNextPath(pDestIDPoint, aPoint) pDestPoint = 1 else if pHoldingFlag = 1 then case gThePad of 1: aPoint = 7 getNextPath(pDestIDPoint, aPoint) pDestPoint = 1 2: aPoint = 3 getNextPath(pDestIDPoint, aPoint) pDestPoint = 1 3: aPoint = 1 getNextPath(pDestIDPoint, aPoint) pDestPoint = 1 4: aPoint = 5 getNextPath(pDestIDPoint, aPoint) pDestPoint = 1 end case else aPoint = random(7) getNextPath(pDestIDPoint, aPoint) pDestPoint = 1 end if end if end on reversePath thePath numElements = count(thePath) revPath = [0] revPath[1] = thePath[count(thePath)] deleteAt(thePath, count(thePath)) repeat with counter = 2 to numElements revPath[counter] = thePath[count(thePath)] deleteAt(thePath, count(thePath)) end repeat return duplicate(revPath) end on doWideTurn case pAntChannel of 54: sprite(59).loc = point(pPositionX + (float(sin(pAngle * 3.14000000000000012 / 180)) * 9), pPositionY + (float(cos(pAngle * 3.14000000000000012 / 180)) * 9)) 55: sprite(60).loc = point(pPositionX + (float(sin(pAngle * 3.14000000000000012 / 180)) * 9), pPositionY + (float(cos(pAngle * 3.14000000000000012 / 180)) * 9)) 56: sprite(61).loc = point(pPositionX + (float(sin(pAngle * 3.14000000000000012 / 180)) * 9), pPositionY + (float(cos(pAngle * 3.14000000000000012 / 180)) * 9)) end case if pAngle <= 180 then if (pExpectedAngle > pAngle) and (pExpectedAngle < (pAngle + 180)) then pAngle = pAngle + 7 else pAngle = pAngle - 7 end if else if (pExpectedAngle < pAngle) and (pExpectedAngle > (pAngle - 180)) then pAngle = pAngle - 7 else pAngle = pAngle + 7 end if end if if pAngle < 0 then pAngle = 359 end if if pAngle >= 360 then pAngle = 0 end if if (pAngle > (pExpectedAngle - 7)) and (pAngle < (pExpectedAngle + 7)) then pAngle = pExpectedAngle pDoWideTurn = 0 end if sprite(pAntChannel).rotation = 360 - pAngle end on doShooting pEnemyShooting = 1 end on continueShooting case pTarget of 1: pTarget = point(gPlayer3.pPositionX, gPlayer3.pPositionY) 2: pTarget = point(gEnemy1.pPositionX, gEnemy1.pPositionY) 3: pTarget = point(gEnemy2.pPositionX, gEnemy2.pPositionY) 4: pTarget = point(gEnemy3.pPositionX, gEnemy3.pPositionY) end case theExpectedAngle = getAngle(pPositionX, pPositionY, pTarget[1], pTarget[2]) if pCannonAngle <= 180 then if (theExpectedAngle > pCannonAngle) and (theExpectedAngle < (pCannonAngle + 180)) then pCannonAngle = pCannonAngle + 7 else pCannonAngle = pCannonAngle - 7 end if else if (theExpectedAngle < pCannonAngle) and (theExpectedAngle > (pCannonAngle - 180)) then pCannonAngle = pCannonAngle - 7 else pCannonAngle = pCannonAngle + 7 end if end if if pCannonAngle < 0 then pCannonAngle = 359 end if if pCannonAngle >= 360 then pCannonAngle = 0 end if sprite(pCannonChannel).rotation = 360 - pCannonAngle if (pCannonAngle > (theExpectedAngle - 7)) and (pCannonAngle < (theExpectedAngle + 7)) then pCannonAngle = theExpectedAngle pEnergy = 0 aChannel = 150 found = 0 repeat while found = 0 if sprite(aChannel).puppet = 1 then aChannel = aChannel + 1 next repeat end if found = 1 end repeat append(gBombList, new(script("BombScript"), pPositionX, pPositionY, 600, 10, 1, aChannel, pAntChannel, pTarget[1], pTarget[2])) repeat with counter = 1 to count(gBombList) if gBombList[counter].pState = 3 then deleteAt(gBombList, counter) end if end repeat pEnemyShooting = 0 end if end