home *** CD-ROM | disk | FTP | other *** search
/ GQ - Louise, World Cup, …remy Clarkson, Armageddon / GQCD.iso / files / game.dxr / 00008_megaAsteroidScript.ls < prev    next >
Encoding:
Text File  |  1998-05-21  |  3.1 KB  |  105 lines

  1. property ancestor, myAngle, myDistance, animCounter, myName, myVelocity, myEnergy, myValue, myDamage, DESTROYED, mySound, myTarget, rocketLoc, SHUTTLEFLAG
  2. global gShipObj, gGameObj, asteroidList, gGUIobj
  3.  
  4. on new me, angle, type, speed, energy, whichSound
  5.   set ancestor to new(script "spriteGenerator")
  6.   set myDistance to 700.0
  7.   set myAngle to angle
  8.   set myName to the memberNum of member type
  9.   set myVelocity to speed
  10.   set myEnergy to energy
  11.   set mySound to whichSound
  12.   set myValue to energy * 10
  13.   set DESTROYED to 0
  14.   set SHUTTLEFLAG to 0
  15.   append(the actorList, me)
  16.   appear(me, getLoc(myAngle, myDistance), type, 255, 28, 100)
  17.   set myHyp to the width of member myName / 2
  18.   set myTarget to new(script "targetScript", 1, myHyp, 12, the spriteNum of me, 30)
  19.   return me
  20. end
  21.  
  22. on stepFrame me
  23.   animateRock(me)
  24.   moveRock(me)
  25. end
  26.  
  27. on moveRock me
  28.   set myDistance to (getGameTimer(gGameObj) * (570.0 / 1800.0)) + 130.0
  29.   if myDistance > 260.0 then
  30.     set the loc of sprite the spriteNum of me to getLoc(myAngle, myDistance)
  31.     if DESTROYED and targetPositionCorrect(myTarget) then
  32.       set DESTROYED to 0
  33.       set myEnergy to myEnergy - myDamage
  34.       if myEnergy < 0.10000000000000001 then
  35.         deleteAt(asteroidList, getPos(asteroidList, me))
  36.         explodeMega(me, myName + 30)
  37.       else
  38.         explode(me, "lrgEX")
  39.       end if
  40.     else
  41.       if DESTROYED then
  42.         set DESTROYED to 0
  43.         explode(me, "lrgEX")
  44.       end if
  45.     end if
  46.   else
  47.     if (myDistance > 190.0) and not SHUTTLEFLAG then
  48.       set SHUTTLEFLAG to 1
  49.       destroy(gShipObj)
  50.       set gShipObj to 0
  51.       destroy(gGUIobj)
  52.       set gGUIobj to 0
  53.       destroy(myTarget)
  54.       go("shuttleExplode")
  55.     else
  56.       if myDistance > 140.0 then
  57.         set the loc of sprite the spriteNum of me to getLoc(myAngle, myDistance)
  58.       else
  59.         deleteAt(asteroidList, getPos(asteroidList, me))
  60.         destroy(me)
  61.         go("finalExplosion")
  62.       end if
  63.     end if
  64.   end if
  65. end
  66.  
  67. on fadeOutRock me
  68.   set fadeNum to integer((myDistance - 130.0) / (20.0 / 100.0))
  69.   if fadeNum > 100 then
  70.     set fadeNum to 100
  71.   end if
  72.   set the blend of sprite the spriteNum of me to fadeNum
  73. end
  74.  
  75. on animateRock me
  76.   set animCounter to animCounter + 1
  77.   if animCounter > 29 then
  78.     set animCounter to 0
  79.   end if
  80.   set myMemberNum to myName + animCounter
  81.   set the memberNum of sprite the spriteNum of me to myMemberNum
  82. end
  83.  
  84. on setDamage me, amount, rLoc
  85.   set rocketLoc to rLoc
  86.   set myDamage to amount
  87. end
  88.  
  89. on explode me, member
  90.   set perimeter to the width of member myName / 2
  91.   set startposition to the loc of sprite the spriteNum of me + point(-perimeter, perimeter)
  92.   playSound(2, mySound)
  93.   set explosion to new(script "explosionScript", member, 20, myDistance - perimeter, myAngle, myVelocity, 0)
  94.   appear(explosion, startposition, member, 255, 0, 50)
  95. end
  96.  
  97. on explodeMega me, member
  98.   set startposition to the loc of sprite the spriteNum of me
  99.   destroy(myTarget)
  100.   destroy(me)
  101.   playSound(2, mySound)
  102.   set explosion to new(script "explosionScript", member, 19, myDistance, myAngle, myVelocity, 1)
  103.   appear(explosion, startposition, member, 255, 0, 100)
  104. end
  105.