home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / optimus / agata / home.dir / 00011_bubble.ls < prev    next >
Encoding:
Text File  |  1997-02-20  |  967 b   |  42 lines

  1. property x, y, xVel, yVel, myChan, myFirstCast, myCurrentCast
  2.  
  3. on birth me, chan
  4.   set myChan to chan
  5.   puppetSprite(myChan, 1)
  6.   set the stretch of sprite myChan to 0
  7.   set the castNum of sprite myChan to 0
  8.   return me
  9. end
  10.  
  11. on startAnimation me
  12.   set the foreColor of sprite myChan to 0
  13.   set myFirstCast to (random(4) * 4) + 47
  14.   set myCurrentCast to myFirstCast
  15.   set x to the mouseH - 5
  16.   set y to the mouseV - 5
  17.   set yVel to -7 - random(10)
  18.   set xVel to -random(10) - 5
  19. end
  20.  
  21. on display me
  22.   set the locH of sprite myChan to x
  23.   set the locV of sprite myChan to y
  24.   set the castNum of sprite myChan to myCurrentCast
  25. end
  26.  
  27. on Animate me
  28.   global theCoord
  29.   display(me)
  30.   if random(3) > 1 then
  31.     set myCurrentCast to myCurrentCast + 1
  32.   end if
  33.   if (the castNum of sprite myChan - myFirstCast) > 3 then
  34.     set the castNum of sprite myChan to 0
  35.     removeBub(theCoord, me)
  36.   else
  37.     set x to x + xVel
  38.     set y to y + yVel
  39.     set yVel to yVel + 7
  40.   end if
  41. end
  42.