home *** CD-ROM | disk | FTP | other *** search
- global playerSO, bulletSO, enemySO, targetSO, bombSO, backGroundSO, shadowSO, maxBullets, maxEnemies, maxtargets, maxShadows, playerData, enemyData, pBulletData, bombData, inputString, particleSO, maxParticles
-
- on initializeConstants
- backGroundSO = 10
- playerSO = 20
- bulletSO = 30
- maxBullets = 6
- enemySO = 40
- maxEnemies = 45
- targetSO = 75
- maxtargets = 10
- bombSO = 90
- particleSO = 95
- maxParticles = 25
- shadowSO = 130
- maxShadows = maxEnemies + 1
- end
-
- on initializeStuff
- global BGtileHeight
- bgScroll = 0
- BGtileHeight = 256
- repeat with wBG = 1 to 5
- wSprite = backGroundSO + wBG
- puppetSprite(wSprite, 1)
- set the member of sprite wSprite to "Terrain 1"
- yloc = 0 - BGtileHeight + (BGtileHeight * wBG) + bgScroll
- xloc = 0
- set the loc of sprite wSprite to point(xloc, yloc)
- sprite(wSprite).locZ = 5
- set the blend of sprite wSprite to 100
- end repeat
- playerData = [1, 0, point(490, 300), point(0, 0), 0, 0]
- puppetSprite(playerSO, 1)
- set the member of sprite playerSO to "PP_00"
- set the ink of sprite playerSO to 36
- sprite(playerSO).locZ = 21
- bombData = [0, point(0, 0), 0, 0]
- puppetSprite(playerSO + 1, 1)
- set the member of sprite (playerSO + 1) to "Player Bomb Target"
- set the ink of sprite (playerSO + 1) to 36
- sprite(playerSO + 1).locZ = 22
- puppetSprite(bombSO, 1)
- set the ink of sprite bombSO to 36
- sprite(bombSO).locZ = 19
- pBulletData = []
- repeat with wBullet = 1 to maxBullets
- add(pBulletData, [0, 0])
- puppetSprite(bulletSO + wBullet, 1)
- set the member of sprite (bulletSO + wBullet) to "Player Bullet"
- set the ink of sprite (bulletSO + wBullet) to 36
- sprite(bulletSO + wBullet).locZ = 20
- end repeat
- enemyData = []
- repeat with wEnemy = 1 to maxEnemies
- wSprite = enemySO + wEnemy
- add(enemyData, [0, 0, point(490, 300), point(0, 0), 0, 0])
- puppetSprite(wSprite, 1)
- set the member of sprite wSprite to "GermanPlane00"
- set the ink of sprite wSprite to 36
- sprite(wSprite).locZ = 19
- set the loc of sprite wSprite to point(-50, -50)
- end repeat
- repeat with wEnemy = 1 to maxShadows
- wSprite = shadowSO + wEnemy
- puppetSprite(wSprite, 1)
- set the member of sprite wSprite to "S_00"
- set the ink of sprite wSprite to 36
- sprite(wSprite).locZ = 9
- sprite(wSprite).flipV = 1
- set the blend of sprite wSprite to 50
- set the loc of sprite wSprite to point(-50, -50)
- end repeat
- sprite(shadowSO + 1).flipV = 0
- end
-
- on movePlayer
- global wMuzzle, bombData, bombSO, bombAccuracyStats, playerData, totalScore, levelScore, deathDelay, playerInvincible, playerLives, shadowSO, playerCool
- if playerData[1] = 1 then
- killPlaya = 0
- repeat with wEnemy = 1 to count(enemyData)
- if enemyData[wEnemy][1] = 1 then
- eType = enemyData[wEnemy][2]
- eLoc = enemyData[wEnemy][3]
- if eType <> 1 then
- if findDistance(eLoc, playerData[3]) <= 25 then
- killPlaya = 1
- end if
- end if
- end if
- end repeat
- if playerInvincible > 0 then
- playerInvincible = playerInvincible - 1
- killPlaya = 0
- end if
- if killPlaya = 1 then
- playerData[1] = 0
- addparticle(5, playerData[3] * 10, point(0, 0))
- deathDelay = 45
- playerLives = playerLives - 1
- set the member of sprite 770 to "Lives Display " & string(playerLives)
- playerInvincible = 60
- playSound("Player Die", 5)
- end if
- end if
- if playerData[1] = 1 then
- if inputString[1] = 1 then
- playerData[4][1] = playerData[4][1] - 2
- else
- if inputString[2] = 1 then
- playerData[4][1] = playerData[4][1] + 2
- else
- playerData[4][1] = playerData[4][1] * 0.80000000000000004
- end if
- end if
- if inputString[4] = 1 then
- playerData[4][2] = playerData[4][2] - 2
- else
- if inputString[3] = 1 then
- playerData[4][2] = playerData[4][2] + 2
- else
- playerData[4][2] = playerData[4][2] * 0.80000000000000004
- end if
- end if
- foundSlot = 0
- if (inputString[6] = 1) and (bombData[1] = 0) then
- playerData[6] = playerData[6] + 1
- set the loc of sprite (playerSO + 1) to playerData[3] + point(0, -150)
- else
- if playerData[6] > 2 then
- bombData = [1, playerData[3] + point(0, -150), 150, 34, 0]
- playSound("dropBomb", 3)
- else
- set the loc of sprite (playerSO + 1) to point(-100, -100)
- end if
- playerData[6] = 0
- end if
- if playerCool > 0 then
- playerCool = playerCool - 1
- else
- playerCool = 2
- if (inputString[5] = 1) and (playerData[6] = 0) then
- playSound("machinegun", 4)
- repeat with wSearch = 1 to count(pBulletData)
- if (value(pBulletData[wSearch][1]) = 0) and (foundSlot = 0) then
- if wMuzzle >= 4 then
- wMuzzle = 1
- else
- wMuzzle = wMuzzle + 1
- end if
- foundSlot = 1
- pBulletData[wSearch] = [1, playerData[3], 0, 0]
- end if
- end repeat
- end if
- end if
- if playerData[4][1] > 9 then
- playerData[4][1] = 9
- end if
- if playerData[4][1] < -9 then
- playerData[4][1] = -9
- end if
- if playerData[4][2] > 9 then
- playerData[4][2] = 9
- end if
- if playerData[4][2] < -9 then
- playerData[4][2] = -9
- end if
- if integer(playerData[4][1]) = 0 then
- set the member of sprite playerSO to "PP_00"
- else
- if playerData[4][1] > 0 then
- set the member of sprite playerSO to "PP_R" & string(abs(integer(playerData[4][1])))
- else
- if playerData[4][1] < 0 then
- set the member of sprite playerSO to "PP_L" & string(abs(integer(playerData[4][1])))
- end if
- end if
- end if
- playerData[3] = playerData[3] + playerData[4]
- drawMuzzle = 1
- set the loc of sprite playerSO to playerData[3]
- else
- set the loc of sprite playerSO to point(-50, -50)
- end if
- if bombData[1] = 1 then
- bombData[4] = bombData[4] - 1.5
- if bombData[4] > 0 then
- bombData[2] = bombData[2] + point(0, 1)
- bombData[3] = bombData[3] * 10 / 11
- set the loc of sprite bombSO to bombData[2] + point(0, bombData[3])
- bombData[5] = bombData[5] + 1
- set the member of sprite bombSO to "Bomb" & string(integer(bombData[5]))
- else
- enemyHit = 0
- testHeight = 0
- repeat with wEnemy = 1 to count(enemyData)
- if (enemyData[wEnemy][1] = 1) and (enemyData[wEnemy][2] = 1) then
- if enemyData[wEnemy][8] = 0 then
- testDist = findDistance(enemyData[wEnemy][3], bombData[2])
- if testDist <= 30 then
- enemyHit = wEnemy
- end if
- end if
- end if
- end repeat
- bombAccuracyStats[1] = bombAccuracyStats[1] + 1
- if enemyHit <> 0 then
- enemyData[enemyHit][6] = enemyData[enemyHit][6] + 100
- else
- addEnemy(1, bombData[2], 9)
- end if
- playSound("explosion", 3)
- addparticle(4, bombData[2] * 10, point(0, 10))
- bombData[1] = 0
- set the loc of sprite bombSO to point(-100, -100)
- end if
- end if
- repeat with wBullet = 1 to count(pBulletData)
- bSprite = bulletSO + wBullet
- if pBulletData[wBullet][1] = 1 then
- if pBulletData[wBullet][4] = 0 then
- enemyHit = 0
- testHeight = 0
- repeat with wEnemy = 1 to count(enemyData)
- if (enemyData[wEnemy][1] = 1) and (pBulletData[wBullet][1] = 1) and (enemyData[wEnemy][2] <> 1) then
- if enemyData[wEnemy][3][2] < playerData[3][2] then
- testDist = abs(pBulletData[wBullet][2][1] - enemyData[wEnemy][3][1])
- if testDist <= 20 then
- if enemyData[wEnemy][3][2] > testHeight then
- testHeight = enemyData[wEnemy][3][2]
- enemyHit = wEnemy
- end if
- end if
- end if
- end if
- end repeat
- oldMuzzlePosList = [15, -25, 25, -15]
- muzzlePosList = [0, 0, 0, 0]
- repeat with wAim = 1 to 4
- newAim = 90 + (abs(integer(playerData[4][1])) * 36 / 4)
- locX = integer(sin(newAim * PI / 180) * oldMuzzlePosList[wAim])
- muzzlePosList[wAim] = locX
- end repeat
- if enemyHit <> 0 then
- enemyData[enemyHit][6] = enemyData[enemyHit][6] + 1
- set the loc of sprite (enemySO + enemyHit) to point(-50, -50)
- set the locV of sprite bSprite to enemyData[enemyHit][3][2]
- pBulletData[wBullet][2] = point(playerData[3][1], enemyData[enemyHit][3][2] + 25) + point(muzzlePosList[wMuzzle], -15)
- pBulletData[wBullet][3] = abs(enemyData[enemyHit][3][2] - playerData[3][2]) / 5 * 3
- else
- pBulletData[wBullet][2] = playerData[3] + point(0, -300) + point(muzzlePosList[wMuzzle], -15)
- pBulletData[wBullet][3] = 300 / 5 * 3
- end if
- else
- if pBulletData[wBullet][4] <= 8 then
- set the member of sprite bSprite to "Player Bullet"
- set the loc of sprite bSprite to pBulletData[wBullet][2]
- set the height of sprite bSprite to pBulletData[wBullet][3]
- set the width of sprite bSprite to 1
- pBulletData[wBullet][3] = pBulletData[wBullet][3] / 1.80000000000000004
- else
- set the loc of sprite bSprite to point(-50, -50)
- pBulletData[wBullet][1] = 0
- end if
- end if
- pBulletData[wBullet][4] = pBulletData[wBullet][4] + 1
- next repeat
- end if
- set the loc of sprite bSprite to point(-50, -50)
- end repeat
- end
-
- on addEnemy spawnType, spawnLoc, extraBit
- global levelDelay
- validSlot = 0
- repeat with wScan = 1 to count(enemyData)
- if (validSlot = 0) and (enemyData[wScan][1] = 0) then
- validSlot = wScan
- end if
- end repeat
- if validSlot <> 0 then
- if spawnType = 1 then
- case random(3) of
- 1:
- rBit = random(3)
- otherwise:
- rBit = random(2) + 3
- end case
- rBit = extraBit
- end if
- if extraBit = 9 then
- healthState = 600
- else
- healthState = 0
- end if
- enemyData[validSlot] = [1, spawnType, spawnLoc, 0, random(500) + 40, healthState, 0, 0, rBit]
- end if
- end
-
- on moveEnemies
- global levelScore, bombData, bombAccuracyStats, totalEnemies, totalScore, shadowData, shadowSO
- shadowData = []
- if playerData[1] = 1 then
- add(shadowData, [playerData[3], integer(playerData[4][1])])
- else
- add(shadowData, [point(-1500, -1500), integer(playerData[4][1])])
- end if
- totalEnemies = 0
- updatePScore = 0
- repeat with wEnemy = 1 to count(enemyData)
- wSprite = enemySO + wEnemy
- if enemyData[wEnemy][1] = 1 then
- terminate = 0
- neutralized = 0
- if enemyData[wEnemy][3][2] > 530 then
- neutralized = 1
- end if
- case enemyData[wEnemy][2] of
- 1:
- moveSpeed = point(0, 1)
- maxHealth = 2
- theDepth = 10
- sweepingMove = 0
- if enemyData[wEnemy][8] = 0 then
- memName = "Structure " & ["A", "B", "C", "D", "E", "F", "G", "H", "I"][enemyData[wEnemy][9]] & "1"
- if enemyData[wEnemy][6] >= maxHealth then
- terminate = 1
- end if
- theDepth = 12
- else
- memName = "Structure " & ["A", "B", "C", "D", "E", "F", "G", "H", "I"][enemyData[wEnemy][9]] & "2"
- theDepth = 10
- end if
- if enemyData[wEnemy][9] <= 4 then
- totalEnemies = totalEnemies + 1
- end if
- 2:
- memName = "GermanPlane"
- moveSpeed = point(0, 2)
- maxHealth = 4
- theDepth = 20
- sweepingMove = 1
- if enemyData[wEnemy][6] >= maxHealth then
- terminate = 1
- end if
- totalEnemies = totalEnemies + 1
- add(shadowData, [enemyData[wEnemy][3], enemyData[wEnemy][7]])
- end case
- if (terminate = 0) and (neutralized = 0) then
- if sweepingMove = 1 then
- if enemyData[wEnemy][4] > 0 then
- enemyData[wEnemy][4] = enemyData[wEnemy][4] - 1
- else
- enemyData[wEnemy][4] = 25 + random(60)
- enemyData[wEnemy][5] = random(500) + 40
- end if
- currMoveSpeed = enemyData[wEnemy][7] * 4
- if enemyData[wEnemy][3][1] > (enemyData[wEnemy][5] - currMoveSpeed) then
- enemyData[wEnemy][7] = enemyData[wEnemy][7] - 1
- else
- if enemyData[wEnemy][3][1] < (enemyData[wEnemy][5] + currMoveSpeed) then
- enemyData[wEnemy][7] = enemyData[wEnemy][7] + 1
- else
- if enemyData[wEnemy][7] > 0 then
- enemyData[wEnemy][7] = enemyData[wEnemy][7] - 1
- else
- if enemyData[wEnemy][7] < 0 then
- enemyData[wEnemy][7] = enemyData[wEnemy][7] + 1
- end if
- end if
- end if
- end if
- if enemyData[wEnemy][7] > 9 then
- enemyData[wEnemy][7] = 9
- end if
- if enemyData[wEnemy][7] < -9 then
- enemyData[wEnemy][7] = -9
- end if
- if enemyData[wEnemy][7] > 0 then
- memName = memName & "R" & string(abs(enemyData[wEnemy][7]))
- shadeName = "S_R" & string(abs(enemyData[wEnemy][7]))
- else
- if enemyData[wEnemy][7] < 0 then
- memName = memName & "L" & string(abs(enemyData[wEnemy][7]))
- shadeName = "S_L" & string(abs(enemyData[wEnemy][7]))
- else
- memName = memName & "00"
- shadeName = "S_00"
- end if
- end if
- moveSpeed[1] = enemyData[wEnemy][7]
- end if
- shadeSprite = shadowSO + wEnemy
- enemyData[wEnemy][3] = enemyData[wEnemy][3] + moveSpeed
- set the loc of sprite wSprite to enemyData[wEnemy][3]
- set the member of sprite wSprite to memName
- sprite(wSprite).locZ = theDepth
- set the member of sprite shadeSprite to shadeName
- next repeat
- end if
- if neutralized = 0 then
- if enemyData[wEnemy][2] = 1 then
- if enemyData[wEnemy][8] = 0 then
- if enemyData[wEnemy][9] <= 4 then
- eOffset = [point(10, 10), point(-10, 10), point(10, -10), point(-10, -10)]
- repeat with woff = 1 to count(eOffset)
- addparticle(4, enemyData[wEnemy][3] * 10, point(0, 10) + (eOffset[woff] * 2))
- end repeat
- eOffset = [point(15, 0), point(-15, 0), point(0, -15), point(0, 15)]
- repeat with woff = 1 to count(eOffset)
- addparticle(4, enemyData[wEnemy][3] * 10, point(0, 10) + (eOffset[woff] * 2))
- end repeat
- levelScore = levelScore + 25
- bombAccuracyStats[2] = bombAccuracyStats[2] + 1
- updatePScore = 1
- end if
- enemyData[wEnemy][8] = 1
- end if
- set the loc of sprite wSprite to enemyData[wEnemy][3]
- enemyData[wEnemy][3] = enemyData[wEnemy][3] + point(0, 1)
- else
- addparticle(5, enemyData[wEnemy][3] * 10, point(0, 20))
- levelScore = levelScore + 10
- playSound("explosion", 5)
- updatePScore = 1
- enemyData[wEnemy][1] = 0
- set the loc of sprite wSprite to point(-100, -100)
- end if
- next repeat
- end if
- enemyData[wEnemy][1] = 0
- set the loc of sprite wSprite to point(-100, -100)
- end if
- end repeat
- maxShadows = maxEnemies + 1
- repeat with wScan = 1 to maxShadows
- wSprite = shadowSO + wScan
- sprite(wSprite).locZ = 10
- if wScan > count(shadowData) then
- set the loc of sprite wSprite to point(-100, -100)
- next repeat
- end if
- set the loc of sprite wSprite to shadowData[wScan][1] + point(20, 20)
- frameNum = shadowData[wScan][2]
- if frameNum > 0 then
- memName = "S_R" & string(abs(frameNum))
- else
- if frameNum < 0 then
- memName = "S_L" & string(abs(frameNum))
- else
- memName = "S_00"
- end if
- end if
- set the member of sprite wSprite to memName
- end repeat
- if updatePScore = 1 then
- member("Player Score Display").text = string(levelScore + totalScore)
- end if
- end
-