home *** CD-ROM | disk | FTP | other *** search
/ GQ - Louise, World Cup, …remy Clarkson, Armageddon / GQCD.iso / files / menu.dxr / 00003_asteroidScript.ls < prev    next >
Encoding:
Text File  |  1998-05-21  |  1.9 KB  |  72 lines

  1. property ancestor, animCounter, myName, mySound, myTargetGraphic, rollLock, myTarget, myMovie
  2. global gGoFlag
  3.  
  4. on new me, type, myPos, whichSound, whichTargetG, whichMovie
  5.   set ancestor to new(script "spriteGenerator")
  6.   set myName to the memberNum of member type
  7.   set myTargetGraphic to whichTargetG
  8.   set myMovie to whichMovie
  9.   set mySound to whichSound
  10.   set animCounter to 0
  11.   set rollLock to 0
  12.   append(the actorList, me)
  13.   appear(me, myPos, type, 255, 0, 8)
  14.   return me
  15. end
  16.  
  17. on stepFrame me
  18.   if rollOver(the spriteNum of me) and the mouseUp and (rollLock = 0) then
  19.     set rollLock to 1
  20.     rollRoutine(me)
  21.   else
  22.     if rollOver(the spriteNum of me) and the mouseDown and (rollLock = 0) then
  23.       set rollLock to 0
  24.       rollRoutine(me)
  25.     else
  26.       if rollOver(the spriteNum of me) and the mouseDown and (rollLock = 1) and not gGoFlag then
  27.         set gGoFlag to 1
  28.         if objectp(myTarget) then
  29.           destroy(myTarget)
  30.           set myTarget to 0
  31.         end if
  32.         explode(me, myName + 60)
  33.       else
  34.         if not rollOver(the spriteNum of me) then
  35.           set rollLock to 0
  36.           if objectp(myTarget) then
  37.             destroy(myTarget)
  38.             set myTarget to 0
  39.           end if
  40.           animateRock(me, 0)
  41.         else
  42.           rollRoutine(me)
  43.         end if
  44.       end if
  45.     end if
  46.   end if
  47. end
  48.  
  49. on rollRoutine me
  50.   if not objectp(myTarget) then
  51.     set myTarget to new(script "targetScript", myTargetGraphic)
  52.   end if
  53.   animateRock(me, 30)
  54. end
  55.  
  56. on animateRock me, deficit
  57.   set animCounter to animCounter + 1
  58.   if animCounter > 29 then
  59.     set animCounter to 0
  60.   end if
  61.   set myMemberNum to myName + animCounter + deficit
  62.   set the memberNum of sprite the spriteNum of me to myMemberNum
  63. end
  64.  
  65. on explode me, member
  66.   set startposition to the loc of sprite the spriteNum of me
  67.   destroy(me)
  68.   playSound(2, mySound)
  69.   set explosion to new(script "explosionScript", member, 20, myMovie)
  70.   appear(explosion, startposition, member, 255, 0, 8)
  71. end
  72.