home *** CD-ROM | disk | FTP | other *** search
- property ancestor, myAngle, myDistance, animCounter, myName, myVelocity, myEnergy, myValue, myDamage, DESTROYED, mySound, myTarget, rocketLoc, SHUTTLEFLAG
- global gShipObj, gGameObj, asteroidList, gGUIobj
-
- on new me, angle, type, speed, energy, whichSound
- set ancestor to new(script "spriteGenerator")
- set myDistance to 700.0
- set myAngle to angle
- set myName to the memberNum of member type
- set myVelocity to speed
- set myEnergy to energy
- set mySound to whichSound
- set myValue to energy * 10
- set DESTROYED to 0
- set SHUTTLEFLAG to 0
- append(the actorList, me)
- appear(me, getLoc(myAngle, myDistance), type, 255, 28, 100)
- set myHyp to the width of member myName / 2
- set myTarget to new(script "targetScript", 1, myHyp, 12, the spriteNum of me, 30)
- return me
- end
-
- on stepFrame me
- animateRock(me)
- moveRock(me)
- end
-
- on moveRock me
- set myDistance to (getGameTimer(gGameObj) * (570.0 / 1800.0)) + 130.0
- if myDistance > 260.0 then
- set the loc of sprite the spriteNum of me to getLoc(myAngle, myDistance)
- if DESTROYED and targetPositionCorrect(myTarget) then
- set DESTROYED to 0
- set myEnergy to myEnergy - myDamage
- if myEnergy < 0.10000000000000001 then
- deleteAt(asteroidList, getPos(asteroidList, me))
- explodeMega(me, myName + 30)
- else
- explode(me, "lrgEX")
- end if
- else
- if DESTROYED then
- set DESTROYED to 0
- explode(me, "lrgEX")
- end if
- end if
- else
- if (myDistance > 190.0) and not SHUTTLEFLAG then
- set SHUTTLEFLAG to 1
- destroy(gShipObj)
- set gShipObj to 0
- destroy(gGUIobj)
- set gGUIobj to 0
- destroy(myTarget)
- go("shuttleExplode")
- else
- if myDistance > 140.0 then
- set the loc of sprite the spriteNum of me to getLoc(myAngle, myDistance)
- else
- deleteAt(asteroidList, getPos(asteroidList, me))
- destroy(me)
- go("finalExplosion")
- end if
- end if
- end if
- end
-
- on fadeOutRock me
- set fadeNum to integer((myDistance - 130.0) / (20.0 / 100.0))
- if fadeNum > 100 then
- set fadeNum to 100
- end if
- set the blend of sprite the spriteNum of me to fadeNum
- end
-
- on animateRock me
- set animCounter to animCounter + 1
- if animCounter > 29 then
- set animCounter to 0
- end if
- set myMemberNum to myName + animCounter
- set the memberNum of sprite the spriteNum of me to myMemberNum
- end
-
- on setDamage me, amount, rLoc
- set rocketLoc to rLoc
- set myDamage to amount
- end
-
- on explode me, member
- set perimeter to the width of member myName / 2
- set startposition to the loc of sprite the spriteNum of me + point(-perimeter, perimeter)
- playSound(2, mySound)
- set explosion to new(script "explosionScript", member, 20, myDistance - perimeter, myAngle, myVelocity, 0)
- appear(explosion, startposition, member, 255, 0, 50)
- end
-
- on explodeMega me, member
- set startposition to the loc of sprite the spriteNum of me
- destroy(myTarget)
- destroy(me)
- playSound(2, mySound)
- set explosion to new(script "explosionScript", member, 19, myDistance, myAngle, myVelocity, 1)
- appear(explosion, startposition, member, 255, 0, 100)
- end
-