home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / optimus / agata / home.dir / 00015_wilbur.ls < prev    next >
Encoding:
Text File  |  1997-02-20  |  2.4 KB  |  68 lines

  1. property myChan1, myChan2, myChan3, maxFrames, currFrame, cast1List, cast2List, cast3List, castList, horizlocList, vertlocList, pos, state
  2.  
  3. on birth me, chan1, chan2, chan3
  4.   global firstTime
  5.   set myChan1 to chan1
  6.   set myChan2 to chan2
  7.   set myChan3 to chan3
  8.   set the stretch of sprite myChan1 to 0
  9.   set the stretch of sprite myChan2 to 0
  10.   set the stretch of sprite myChan3 to 0
  11.   set state to #dontMove
  12.   set horizlocList to [24, 245, 551, 420, 230]
  13.   set vertlocList to [362, 147, 279, 158, 160]
  14.   if firstTime then
  15.     set pos to 1
  16.   else
  17.     set pos to random(count(horizlocList))
  18.   end if
  19.   set the locH of sprite myChan1 to getAt(horizlocList, pos)
  20.   set the locV of sprite myChan1 to getAt(vertlocList, pos)
  21.   set the locH of sprite myChan2 to getAt(horizlocList, pos) - 1
  22.   set the locV of sprite myChan2 to getAt(vertlocList, pos)
  23.   set the locH of sprite myChan3 to getAt(horizlocList, pos)
  24.   set the locV of sprite myChan3 to getAt(vertlocList, pos)
  25.   return me
  26. end
  27.  
  28. on startAnimation me
  29.   set state to #move
  30.   set currFrame to 1
  31.   set rand to random(2)
  32.   if rand = 1 then
  33.     set cast1List to [550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550]
  34.     set cast2List to [551, 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, 551]
  35.     set cast3List to [0, 0, 0, 0, 0, 568, 568, 0, 0, 568, 568, 0, 0]
  36.     set maxFrames to count(cast1List)
  37.   else
  38.     set cast1List to [550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550]
  39.     set cast2List to [551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567]
  40.     set cast3List to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  41.     set maxFrames to count(cast1List)
  42.   end if
  43. end
  44.  
  45. on Animate me
  46.   if state = #dontMove then
  47.     set rand to random(20)
  48.     if rand = 1 then
  49.       startAnimation(me)
  50.     end if
  51.   else
  52.     if currFrame <= maxFrames then
  53.       set cast1Index to getAt(cast1List, currFrame)
  54.       set cast2Index to getAt(cast2List, currFrame)
  55.       set cast3Index to getAt(cast3List, currFrame)
  56.       set the castNum of sprite myChan1 to cast1Index
  57.       set the castNum of sprite myChan2 to cast2Index
  58.       set the castNum of sprite myChan3 to cast3Index
  59.     else
  60.       set the castNum of sprite myChan1 to 550
  61.       set the castNum of sprite myChan2 to 551
  62.       set the castNum of sprite myChan3 to 0
  63.       set state to #dontMove
  64.     end if
  65.     set currFrame to currFrame + 1
  66.   end if
  67. end
  68.