home *** CD-ROM | disk | FTP | other *** search
- property pAngle, pMovementSpeed, pAnimationSpeed, pPositionX, pPositionY, pSpriteName, pAntChannel, pHealth, pMaxHealth, pFakeChannel, pMaxFrameNumber, pDoDeath, pDoShooting, pPlayerDisabled, pEnergy, pDestPositionX, pDestPositionY, pState, pMoving, pTempX, pTempY, pACounter, pBCounter, pATimer, pReadyTaLaunch, pDaPath, pPathFind, pCurrentNode, pPray, pObjectif, pIsHoldingObject, pStundTime, pCurrentFrame, pCannonAngle, pMaxSpeed
- global gCurrentLevel, gPlayer1, gPlayer2, gPlayer3, gEnemy1, gEnemy2, gEnemy3, gBombList, gTotalHealth, gTotalScore, gFlagSeised
-
- on new me, antDirection, antSpeed, animationSpeed, posX, posY, spriteName, antChannel
- pMaxSpeed = 5
- pCannonAngle = 0
- pAngle = 0
- pCurrentFrame = 1
- pObjectif = 1
- pIsHoldingObject = 0
- pMoving = 0
- pDirection = antDirection
- pMovementSpeed = antSpeed
- pAnimationSpeed = animationSpeed
- pPositionX = posX
- pPositionY = posY
- pTempX = posX
- pTempY = posY
- pSpriteName = spriteName
- pAntChannel = antChannel
- pHealth = 50
- pMaxHealth = 50
- pFakeChannel = 15
- pMaxFrameNumber = 1
- pDoDeath = 0
- pPlayerDisabled = 0
- pEnergy = 0
- pDestPositionX = posX
- pDestPositionY = posY
- pSelected = 0
- pPray = 0
- pState = 1
- pATimer = the ticks
- pReadyTaLaunch = 0
- pPathFind = 0
- sprite(pAntChannel).loc = point(pPositionX, pPositionY)
- sprite(62).rotation = pCannonAngle
- pACounter = 0
- pBCounter = 0
- return me
- end
-
- on setSpeed me, theSpeed
- pMovementSpeed = theSpeed
- if pMovementSpeed > pMaxSpeed then
- pMovementSpeed = pMaxSpeed
- end if
- if pMovementSpeed < 0 then
- pMovementSpeed = 0
- end if
- end
-
- on setAngle me, theAngle
- if pState = 6 then
- exit
- end if
- if theAngle > 359 then
- theAngle = 0
- end if
- if theAngle < 0 then
- theAngle = 359
- end if
- pAngle = theAngle
- sprite(pAntChannel).rotation = 360 - pAngle
- end
-
- on getAntChannel me
- return pAntChannel
- end
-
- on moveAnt me
- howDeep = spriteColision(sprite(pAntChannel).rect, 1)
- if howDeep = 2 then
- pMaxSpeed = 1
- else
- if howDeep = 1 then
- pMaxSpeed = 3
- else
- pMaxSpeed = 5
- end if
- end if
- if pMovementSpeed > pMaxSpeed then
- pMovementSpeed = pMaxSpeed
- end if
- if pState = 6 then
- pIsHoldingFlag = 0
- gFlagSeized = 0
- doStund()
- exit
- end if
- if pIsHoldingObject = 1 then
- sprite(20).loc = sprite(pAntChannel).loc
- end if
- if pState = 3 then
- exit
- end if
- pTempX = pPositionX
- pTempY = pPositionY
- difX = float(sin(pAngle * 3.14000000000000012 / 180)) * pMovementSpeed
- difY = float(cos(pAngle * 3.14000000000000012 / 180)) * pMovementSpeed
- pPositionX = pPositionX - difX
- pPositionY = pPositionY - difY
- if pPositionX < 10 then
- pPositionX = 10
- end if
- if pPositionX > 570 then
- pPositionX = 570
- end if
- if pPositionY < 10 then
- pPositionY = 10
- end if
- if pPositionY > 430 then
- pPositionY = 430
- end if
- if the ticks > (pATimer + 1) then
- pATimer = the ticks
- pCurrentFrame = pCurrentFrame + 1
- if pCurrentFrame > pMaxFrameNumber then
- pCurrentFrame = 1
- end if
- sprite(pAntChannel).member = pSpriteName & "_" & string(pCurrentFrame)
- end if
- if (pAntChannel = 50) or (pAntChannel = 51) or (pAntChannel = 52) then
- sprite(13).loc = point(pPositionX, pPositionY)
- updateStage()
- if (sprite(13).intersects(7) = 1) or (sprite(13).intersects(8) = 1) then
- pPositionX = pPositionX + difX
- sprite(13).loc = point(pPositionX, pPositionY)
- updateStage()
- if (sprite(13).intersects(7) = 1) or (sprite(13).intersects(8) = 1) then
- pPositionX = pPositionX - difX
- pPositionY = pPositionY + difY
- sprite(13).loc = point(pPositionX, pPositionY)
- updateStage()
- if (sprite(13).intersects(7) = 1) or (sprite(13).intersects(8) = 1) then
- pPositionX = pTempX
- pPositionY = pTempY
- end if
- end if
- end if
- end if
- sprite(pAntChannel).loc = point(pPositionX, pPositionY)
- sprite(62).loc = point(pPositionX + (float(sin(pAngle * 3.14000000000000012 / 180)) * 9), pPositionY + (float(cos(pAngle * 3.14000000000000012 / 180)) * 9))
- whatAngle = 360 - getAngle(pPositionX, pPositionY, mouseH(), mouseV())
- difference = abs(pCannonAngle - whatAngle)
- if difference > 180 then
- difference = 360 - difference
- end if
- if difference > 10 then
- if pCannonAngle <= 180 then
- if (whatAngle > pCannonAngle) and (whatAngle < (pCannonAngle + 180)) then
- pCannonAngle = pCannonAngle + 7
- else
- pCannonAngle = pCannonAngle - 7
- end if
- else
- if (whatAngle < pCannonAngle) and (whatAngle > (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
- else
- pCannonAngle = whatAngle
- end if
- sprite(62).rotation = pCannonAngle
- end
-
- on setAntPosition me, posX, posY
- if pState = 6 then
- exit
- end if
- pPositionX = posX
- pPositionY = posY
- sprite(pAntChannel).locH = pPositionX
- sprite(pAntChannel).locV = pPositionY
- end
-
- on getAntPositionX me
- return pPositionX
- end
-
- on getAntPositionY me
- return pPositionY
- end
-
- on setEnergy me, theEnergy
- pEnergy = theEnergy
- if pEnergy > 48 then
- pEnergy = 48
- end if
- if pEnergy < 0 then
- pEnergy = 0
- end if
- sprite(282).right = sprite(282).left + pEnergy
- end
-
- on getEnergy me
- return pEnergy
- end
-
- on doDyeSequence me
- end
-
- on doGetsHurt me
- end
-
- on setDaPath me, thePath
- pDaPath = thePath
- pPathFind = 1
- pCurrentNode = 1
- end
-
- on startBombThrow me
- if pState = 6 then
- exit
- end if
- if pState = 3 then
- exit
- end if
- pReadyTaLaunch = 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))
- aAngle = gBombList[count(gBombList)].getAngle()
- sprite(pAntChannel).member = pSpriteName & "Throwing" & "_2"
- pState = 2
- pACounter = 0
- repeat with counter = 1 to count(gBombList)
- if gBombList[counter].pState = 3 then
- deleteAt(gBombList, counter)
- end if
- end repeat
- end
-
- on doAttackSequence me
- if pState = 3 then
- exit
- end if
- pACounter = pACounter + 1
- if pACounter > 5 then
- pACounter = 0
- pState = 1
- sprite(pAntChannel).member = pSpriteName & "_1"
- end if
- end
-
- on doStund
- if (pStundTime + 150) < the ticks then
- pState = 1
- sprite(68).loc = point(800, 800)
- end if
- end
-