home *** CD-ROM | disk | FTP | other *** search
- property ancestor, myAngle, myDistance, animCounter, myName, myVelocity, myEnergy, myValue, myDamage, DESTROYED, mySound
- global gShipObj, asteroidList
-
- 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
- append(the actorList, me)
- appear(me, getLoc(myAngle, myDistance), type, 255, 0, 100)
- return me
- end
-
- on stepFrame me
- animateRock(me)
- moveRock(me)
- end
-
- on moveRock me
- set myDistance to myDistance - myVelocity
- if myDistance > 180.0 then
- set the loc of sprite the spriteNum of me to getLoc(myAngle, myDistance)
- if DESTROYED then
- set DESTROYED to 0
- set myCurrentNum to myName + animCounter + 30
- set the memberNum of sprite the spriteNum of me to myCurrentNum
- set myEnergy to myEnergy - myDamage
- if myEnergy < 0.10000000000000001 then
- increaseEnergyLevel(gGameObj, myValue)
- deleteAt(asteroidList, getPos(asteroidList, me))
- explode(me, myName + 60)
- end if
- end if
- else
- if myDistance > 80.0 then
- set the loc of sprite the spriteNum of me to getLoc(myAngle, myDistance)
- fadeOutRock(me)
- else
- increaseEnergyLevel(gGameObj, -(myValue * 2))
- deleteAt(asteroidList, getPos(asteroidList, me))
- playSound(2, mySound)
- destroy(me)
- end if
- end if
- end
-
- on fadeOutRock me
- set fadeNum to integer(myDistance - 80.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
- set myDamage to amount
- end
-
- on explode me, member
- set startposition to the loc of sprite the spriteNum of me
- destroy(me)
- playSound(2, mySound)
- set explosion to new(script "explosionScript", member, 20, myDistance, myAngle, myVelocity, 0)
- appear(explosion, startposition, member, 255, 0, 50)
- end
-