home *** CD-ROM | disk | FTP | other *** search
- on exitFrame me
- global reloadRate, reloadTimer, bgOffset, deathState, meteorData, spawnDelay, playerData, playerSO, totalRocks, playerScore, droneData, maxDrones, droneSO, laserData, alienData, maxAliens, alienSO
- reloadRate = 20 - integer(totalRocks / 3)
- if reloadRate < 1 then
- reloadRate = 1
- end if
- reloadTimer = reloadTimer + 1
- if reloadTimer > reloadRate then
- reloadTimer = 0
- addDrone()
- end if
- runDrones()
- runAliens()
- runLasers()
- if meteorData[1] = 0 then
- if spawnDelay > 0 then
- spawnDelay = spawnDelay - 1
- else
- spawnDelay = 30 + random(20)
- case random(2) of
- 1:
- spawnloc = point([0, 5800][random(2)], random(4400))
- 2:
- spawnloc = point(random(5800), [0, 4400][random(2)])
- end case
- set the member of sprite 6 to "Asteroid" & string(random(3))
- meteorData[1] = 1
- meteorData[2] = spawnloc
- modPoint = point(1, 1)
- if random(2) = 1 then
- modPoint[1] = -1
- end if
- if random(2) = 1 then
- modPoint[2] = -1
- end if
- meteorData[3] = (point(random(5), random(5)) * modPoint) + (modPoint * 2)
- end if
- end if
- if meteorData[1] = 1 then
- meteorData[2] = meteorData[2] + meteorData[3]
- meteorData[4] = meteorData[4] + 6
- if meteorData[3][1] > 0 then
- if meteorData[2][1] > 6000 then
- meteorData[2][1] = -200
- end if
- else
- if meteorData[2][1] < -200 then
- meteorData[2][1] = 6000
- end if
- end if
- if meteorData[3][2] > 0 then
- if meteorData[2][2] > 4600 then
- meteorData[2][2] = -200
- end if
- else
- if meteorData[2][2] < -200 then
- meteorData[2][2] = 4600
- end if
- end if
- end if
- if meteorData[1] = 1 then
- meteorDist = findDistance(meteorData[2], playerData[2])
- if meteorDist <= 250 then
- meteorData[1] = 0
- playerScore = playerScore + 100 + (totalRocks * 10)
- totalRocks = totalRocks + 1
- if (totalRocks mod 5) = 0 then
- addAlien()
- end if
- playSound("collect asteroid SFX", 5)
- member("Score Display").text = string(playerScore)
- end if
- end if
- if meteorData[1] = 1 then
- set the loc of sprite 6 to meteorData[2] / 10
- sprite(6).rotation = meteorData[4]
- else
- set the loc of sprite 6 to point(-50, -50)
- end if
- bgOffset = the loc of sprite 1
- targAim = (the mouseLoc - bgOffset) * 10
- if deathState = 0 then
- pLoc = playerData[2]
- pAim = findAngle(pLoc, targAim)
- pDist = findDistance(pLoc, targAim)
- playerSpeed = 20
- if pDist <= playerSpeed then
- else
- locY = integer(cos(pAim * PI / 180) * -playerSpeed)
- locX = integer(sin(pAim * PI / 180) * playerSpeed)
- playerData[2] = playerData[2] + point(locX, locY)
- end if
- destruct = 0
- coreloc = playerData[2]
- closestDist = 750
- repeat with wScan = 1 to maxDrones
- if droneData[wScan][1] = 1 then
- dLoc = droneData[wScan][2]
- dist = findDistance(coreloc, dLoc)
- if dist < closestDist then
- closestDist = dist
- end if
- if dist <= 75 then
- wSprite = wScan + droneSO - 1
- set the loc of sprite wSprite to point(-10, -10)
- droneData[wScan][1] = 0
- destruct = 1
- set the member of sprite 5 to "Explosion"
- end if
- end if
- end repeat
- swarmVolume = 200 - (200 * closestDist / 750)
- if swarmVolume < 0 then
- swarmVolume = 0
- end if
- if swarmVolume > 200 then
- swarmVolume = 200
- end if
- sound(2).volume = swarmVolume
- coreloc = playerData[2]
- repeat with wScan = 1 to count(laserData)
- if laserData[wScan][1] = 1 then
- dLoc = laserData[wScan][2]
- dist = findDistance(coreloc, dLoc)
- if dist <= 150 then
- destruct = 1
- set the member of sprite 5 to "Explosion"
- end if
- end if
- end repeat
- coreloc = playerData[2]
- repeat with wScan = 1 to maxAliens
- if alienData[wScan][1] = 1 then
- dLoc = alienData[wScan][2]
- dist = findDistance(coreloc, dLoc)
- if dist <= 175 then
- wSprite = wScan + alienSO - 1
- set the loc of sprite wSprite to point(-10, -10)
- alienData[wScan][1] = 0
- destruct = 1
- set the member of sprite 5 to "Explosion"
- end if
- end if
- end repeat
- end if
- hitBorder = 0
- if playerData[2][1] > 5700 then
- hitBorder = 1
- end if
- if playerData[2][1] < 100 then
- hitBorder = 1
- end if
- if playerData[2][2] > 4100 then
- hitBorder = 1
- end if
- if playerData[2][2] < 100 then
- hitBorder = 1
- end if
- if hitBorder = 1 then
- destruct = 1
- set the member of sprite 5 to "Explosion"
- end if
- if (destruct = 1) and (deathState = 0) then
- playSound("Explode SFX", 3)
- deathState = 1
- end if
- if deathState > 0 then
- deathState = deathState + 1
- end if
- set the loc of sprite playerSO to (playerData[2] / 10) + bgOffset
- sprite(playerSO).rotation = pAim + 180
- if deathState < 60 then
- go(the frame)
- else
- go(25)
- end if
- end
-