home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / BlackHole.dxr / 00098_martian.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  1.1 KB  |  45 lines

  1. property ufo, spriteNum, ogLoc, newloc, motion, vanish, direc, di
  2.  
  3. on beginSprite me
  4.   ufo = sprite(spriteNum)
  5.   ufo.blend = 0
  6.   ogLoc = ufo.loc
  7.   di = [1, -1]
  8.   direc = di[random(di.count)]
  9.   newloc = ogLoc + point(150 * direc, 0)
  10.   puppetSound(4, member("beamer"))
  11.   vanish = timeout("lll").new(10, #reapp, me)
  12. end
  13.  
  14. on reapp me
  15.   if ufo.blend < 100 then
  16.     ufo.blend = ufo.blend + 1
  17.   else
  18.     vanish.forget()
  19.     motion = timeout(string(the ticks)).new(10, #moveit, me)
  20.   end if
  21. end
  22.  
  23. on moveit me
  24.   if ufo.loc <> newloc then
  25.     ufo.loc = ufo.loc + point(direc, 0)
  26.   else
  27.     motion.forget()
  28.     vanish = timeout(string(the ticks)).new(10, #disapp, me)
  29.   end if
  30. end
  31.  
  32. on disapp me
  33.   if ufo.blend > 0 then
  34.     ufo.blend = ufo.blend - 1
  35.   else
  36.     vanish.forget()
  37.     ufo.loc = point(random(the stageRight - 50 - (the stageLeft + 50)), random(the stageBottom - 50 - (the stageTop + 50)))
  38.     direc = di[random(di.count)]
  39.     ogLoc = ufo.loc
  40.     newloc = ogLoc + point((random(100) + 100) * direc, 0)
  41.     puppetSound(4, member("beamer"))
  42.     vanish = timeout(string(the ticks)).new(10, #reapp, me)
  43.   end if
  44. end
  45.