home *** CD-ROM | disk | FTP | other *** search
- property pDirection, pMovementSpeed, pFrameNumber, pAnimationSpeed, pEnemyAlert, pPositionX, pPositionY, pEnemyChannel, pDestDirection, pAlertTime, pInalertTime, pYDelta, pXDelta, pDefaultSpeed, pCounter, pCheckTurn, pCharacterName, pState, pMaxFrameNumer, pDoDeath, pTeleport, pBiggerBomb, pDoingTeleport, pJustABool, pHealth, pEneRect, pFakeHalfWidth, pFakeHalfHeight, pSpriteHalfWidth, pSpriteHalfHeight
- global gMapChannel, pEneBombList, gCurrentLevel
-
- on new me, enemyDirection, enemySpeed, animationSpeed, posX, posY, characterName, enemyChannel
- pFakeHalfWidth = sprite(12).width / 2
- pFakeHalfHeight = sprite(12).height / 2
- pDoingTeleport = 0
- pJustABool = 1
- pCharacterName = characterName
- pCounter = 0
- pYDelta = 0
- pXDelta = 0
- pAlertTime = 0
- pInalertTime = 0
- pDirection = enemyDirection
- pEneBombList = [0, 0]
- pMovementSpeed = enemySpeed
- pDoDeath = 0
- pAnimationSpeed = animationSpeed
- pEnemyChannel = enemyChannel
- pEnemyAlert = 1
- pPositionX = posX
- pPositionY = posY
- pFrameNumber = 1
- sprite(pEnemyChannel).puppet = 1
- sprite(pEnemyChannel).member = "Enemy"
- sprite(pEnemyChannel).locH = pPositionX
- sprite(pEnemyChannel).locV = pPositionY
- sprite(pEnemyChannel).ink = 36
- sprite(pEnemyChannel).blend = 100
- setEnemyDirection(me, pDirection)
- pMaxFrameNumer = 4
- pHealth = 48
- updateStage()
- pSpriteHalfWidth = sprite(12).width / 2
- pSpriteHalfHeight = sprite(12).height / 2
- return me
- end
-
- on setEnemyChannel enemyChannel
- sprite(pEnemyChannel).puppet = 0
- sprite(enemyChannel).puppet = 1
- sprite(enemyChannel).member = "Enemy"
- sprite(enemyChannel).locH = pPositionX
- sprite(enemyChannel).locV = pPositionY
- sprite(enemyChannel).backColor = 6
- sprite(enemyChannel).ink = 36
- pEnemyChannel = enemyChannel
- end
-
- on getEnemyChannel me
- return pEnemyChannel
- end
-
- on nextAnimation me
- end
-
- on moveEnemy me
- case pDirection of
- 1:
- pPositionY = pPositionY - pMovementSpeed
- pYDelta = pYDelta + pMovementSpeed
- 2:
- pPositionX = pPositionX + pMovementSpeed
- pXDelta = pXDelta + pMovementSpeed
- 3:
- pPositionY = pPositionY + pMovementSpeed
- pYDelta = pYDelta + pMovementSpeed
- 4:
- pPositionX = pPositionX - pMovementSpeed
- pXDelta = pXDelta + pMovementSpeed
- end case
- pEneRect = rect(pPositionX - pSpriteHalfWidth, pPositionY - pSpriteHalfHeight, pPositionX + pSpriteHalfWidth, pPositionY + pSpriteHalfHeight)
- if thisIsMYIntersectionFunctionBitch(pEneRect, 7) = 1 then
- case pDirection of
- 1:
- pPositionY = pPositionY + pMovementSpeed
- pYDelta = pYDelta - pMovementSpeed
- 2:
- pPositionX = pPositionX - pMovementSpeed
- pXDelta = pXDelta - pMovementSpeed
- 3:
- pPositionY = pPositionY - pMovementSpeed
- pYDelta = pXDelta - pMovementSpeed
- 4:
- pPositionX = pPositionX + pMovementSpeed
- pXDelta = pXDelta - pMovementSpeed
- end case
- end if
- if thisIsMYIntersectionFunctionBitch(pEneRect, 7) = 1 then
- switchDirection()
- end if
- sprite(pEnemyChannel).loc = point(pPositionX, pPositionY)
- end
-
- on setEnemyPosition me, posX, posY
- pPositionX = posX
- pPositionY = posY
- sprite(pEnemyChannel).locH = pPositionX
- sprite(pEnemyChannel).locV = pPositionY
- end
-
- on getEnemyPositionX me
- return pPositionX
- end
-
- on getEnemyPositionY me
- return pPositionY
- end
-
- on setEnemyDirection me, enemyDirection
- pDirection = enemyDirection
- end
-
- on getEnemyDirection me
- return pDirection
- end
-
- on switchDirection me
- orgX = sprite(pEnemyChannel).locH
- orgY = sprite(pEnemyChannel).locV
- aPosX = orgX
- aPosY = orgY
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- case pDirection of
- 1:
- if random(2) = 1 then
- aPosX = aPosX + 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- aPosX = orgX
- aPosY = orgY
- aPosX = aPosX - 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- directionNum = 3
- else
- directionNum = 4
- end if
- else
- directionNum = 2
- end if
- else
- aPosX = aPosX - 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- aPosX = orgX
- aPosY = orgY
- aPosX = aPosX + 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- directionNum = 3
- else
- directionNum = 2
- end if
- else
- directionNum = 4
- end if
- end if
- 2:
- if random(2) = 1 then
- aPosY = aPosY + 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- aPosX = orgX
- aPosY = orgY
- aPosY = aPosY - 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- directionNum = 4
- else
- directionNum = 1
- end if
- else
- directionNum = 3
- end if
- else
- aPosY = aPosY - 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- aPosX = orgX
- aPosY = orgY
- aPosY = aPosY + 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- directionNum = 4
- else
- directionNum = 3
- end if
- else
- directionNum = 1
- end if
- end if
- 3:
- if random(2) = 1 then
- aPosX = aPosX + 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- aPosX = orgX
- aPosY = orgY
- aPosX = aPosX - 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- directionNum = 1
- else
- directionNum = 4
- end if
- else
- directionNum = 2
- end if
- else
- aPosX = aPosX - 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- aPosX = orgX
- aPosY = orgY
- aPosX = aPosX + 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- directionNum = 1
- else
- directionNum = 2
- end if
- else
- directionNum = 4
- end if
- end if
- 4:
- if random(2) = 1 then
- aPosY = aPosY + 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- aPosX = orgX
- aPosY = orgY
- aPosY = aPosY - 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- directionNum = 2
- else
- directionNum = 1
- end if
- else
- directionNum = 3
- end if
- else
- aPosY = aPosY - 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- aPosX = orgX
- aPosY = orgY
- aPosY = aPosY + 10
- theRect = rect(aPosX - pFakeHalfWidth, aPosY - pFakeHalfHeight, aPosX + pFakeHalfWidth, aPosY - pFakeHalfHeight)
- if thisIsMYIntersectionFunctionBitch(theRect, 7) then
- directionNum = 2
- else
- directionNum = 3
- end if
- else
- directionNum = 1
- end if
- end if
- end case
- setEnemyDirection(me, directionNum)
- end
-
- on doDeathAnimation me
- if sprite(pEnemyChannel).blend < 5 then
- if gCurrentLevel >= 4 then
- puppetSound(3, "win10")
- go(24)
- else
- go(44)
- exit
- end if
- end if
- sprite(pEnemyChannel).blend = sprite(pEnemyChannel).blend - 2
- end
-