home *** CD-ROM | disk | FTP | other *** search
- property ancestor, posX, posY, myHyp, myShipAngle, myMouseAngle, rocketNum, myVelocity, weaponName, weaponReload, weaponPower, timerStart, weaponSound
- global CURSORSTART, gGameObj
-
- on new me, startAngle, hyp
- set ancestor to new(script "spriteGenerator")
- set timerStart to the timer
- set myShipAngle to startAngle
- set myHyp to hyp
- append(the actorList, me)
- return me
- end
-
- on stepFrame me
- if getnukesArmed(gGameObj) then
- cursor(-1)
- set myMouseAngle to 45.0
- else
- locateMouse(me)
- end if
- setVelocity(me)
- moveShip(me)
- turnShip(me)
- end
-
- on locateMouse me
- set posX to float(the mouseH)
- set posY to float(480 - the mouseV)
- if (posY > 0) and (posX > 0) then
- set myMouseAngle to getDegrees(atan(posX / posY))
- else
- if posY < 0.0001 then
- set myMouseAngle to 90.0
- else
- if posX < 0.0001 then
- set myMouseAngle to 0.0
- end if
- end if
- end if
- end
-
- on setVelocity me
- set myVelocity to abs(myMouseAngle - myShipAngle) / 4.0
- if myVelocity < 1.0 then
- set myVelocity to 1.0
- end if
- end
-
- on moveShip me
- if (myMouseAngle > myShipAngle) and (myMouseAngle > (myShipAngle + myVelocity)) then
- if not getnukesArmed(gGameObj) then
- cursor([CURSORSTART + 2, CURSORSTART + 3])
- end if
- set myShipAngle to myShipAngle + myVelocity
- if myShipAngle > 90.0 then
- set myShipAngle to 90.0
- end if
- set the loc of sprite the spriteNum of me to getLoc(myShipAngle, myHyp)
- else
- if (myMouseAngle < myShipAngle) and (myMouseAngle < (myShipAngle - myVelocity)) then
- if not getnukesArmed(gGameObj) then
- cursor([CURSORSTART + 2, CURSORSTART + 3])
- end if
- set myShipAngle to myShipAngle - myVelocity
- if myShipAngle < 0.0 then
- set myShipAngle to 0.0
- end if
- set the loc of sprite the spriteNum of me to getLoc(myShipAngle, myHyp)
- else
- if not getnukesArmed(gGameObj) then
- cursor([CURSORSTART, CURSORSTART + 1])
- end if
- set myShipAngle to myMouseAngle
- set the loc of sprite the spriteNum of me to getLoc(myShipAngle, myHyp)
- end if
- end if
- end
-
- on turnShip me
- set myMemberNum to integer(abs(myShipAngle - 90))
- if myMemberNum = 0 then
- set myMemberNum to 1
- end if
- set myMemberNum to myMemberNum + the memberNum of member "firstShip" - 1
- set the memberNum of sprite the spriteNum of me to myMemberNum
- end
-
- on launchRocket me
- if (the timer > (timerStart + weaponReload)) and (rocketNum < 21) then
- logShot(gGameObj)
- set timerStart to the timer
- set rocketNum to rocketNum + 1
- set newHyp to myHyp + 20
- set newRocket to new(script "rocketScript", myShipAngle, newHyp, weaponPower)
- set myMemNum to integer(abs(myShipAngle))
- if myMemNum = 0 then
- set myMemNum to 1
- end if
- appear(newRocket, getLoc(myShipAngle, newHyp), myMemNum + weaponName, 255, 0, 100)
- playSound(1, weaponSound)
- end if
- end
-
- on depleteRocketNum me
- if rocketNum > 0 then
- set rocketNum to rocketNum - 1
- end if
- end
-
- on changeWeapon me, newName, newReload, newPower, newSound
- set weaponName to the memberNum of member newName - 1
- set weaponReload to newReload * 60.0
- set weaponPower to newPower
- set weaponSound to newSound
- end
-