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

  1. property myChan1, myChan2, maxFrames, currFrame, cast1List, cast2List, x1List, y1List, state, rolledOver
  2.  
  3. on birth me, chan1, chan2
  4.   set myChan1 to chan1
  5.   set myChan2 to chan2
  6.   set the stretch of sprite myChan1 to 0
  7.   set the stretch of sprite myChan2 to 0
  8.   set state to #dontMove
  9.   set rolledOver to 0
  10.   return me
  11. end
  12.  
  13. on startAnimation me
  14.   set state to #move
  15.   set rand to random(7)
  16.   if rand = 1 then
  17.     set var to 3
  18.     do("var" & var & " me")
  19.   else
  20.     set var to random(2)
  21.     do("var" & var & " me")
  22.   end if
  23.   set currFrame to 1
  24. end
  25.  
  26. on Animate me
  27.   global theCoord
  28.   if state = #dontMove then
  29.     set rand to random(30)
  30.     set the castNum of sprite myChan1 to 68
  31.     set the locH of sprite myChan1 to 502
  32.     set the locV of sprite myChan1 to 80
  33.     if rand = 1 then
  34.       startAnimation(me)
  35.     end if
  36.   else
  37.     if not rolledOver then
  38.       if currFrame <= maxFrames then
  39.         set the locH of sprite myChan1 to getAt(x1List, currFrame)
  40.         set the locV of sprite myChan1 to getAt(y1List, currFrame)
  41.         set cast1Index to getAt(cast1List, currFrame)
  42.         set cast2Index to getAt(cast2List, currFrame)
  43.         set the castNum of sprite myChan1 to cast1Index
  44.         set the castNum of sprite myChan2 to cast2Index
  45.       else
  46.         set the castNum of sprite myChan1 to 68
  47.         set the locH of sprite myChan1 to 502
  48.         set the locV of sprite myChan1 to 80
  49.         set the castNum of sprite myChan2 to 0
  50.         set state to #dontMove
  51.       end if
  52.       set currFrame to currFrame + 1
  53.     end if
  54.   end if
  55.   if not (the cursorHidden of theCoord) then
  56.     if ((the mouseCast > 66) and (the mouseCast < 72)) or (the mouseCast = 225) then
  57.       set the locH of sprite myChan1 to 497
  58.       set the locV of sprite myChan1 to 52
  59.       set the castNum of sprite myChan1 to 225
  60.       set the castNum of sprite myChan2 to 0
  61.       set rolledOver to 1
  62.     else
  63.       set rolledOver to 0
  64.     end if
  65.   end if
  66. end
  67.  
  68. on var1 me
  69.   set cast1List to [68, 69, 70, 68, 70, 69, 68, 68, 68, 68, 69, 68, 70, 69, 70, 68, 68, 68, 68, 68, 68]
  70.   set cast2List to [0, 72, 73, 74, 75, 76, 72, 73, 74, 75, 76, 0, 72, 73, 74, 72, 73, 74, 75, 76, 0]
  71.   set maxFrames to 21
  72.   set x1List to [502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502]
  73.   set y1List to [80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80]
  74.   set the locH of sprite myChan2 to 464
  75.   set the locV of sprite myChan2 to 84
  76. end
  77.  
  78. on var2 me
  79.   set cast1List to [68, 69, 71, 69, 67, 69, 68, 68, 68, 68, 68, 68]
  80.   set cast2List to [0, 0, 72, 73, 74, 75, 76, 0, 0, 0, 0, 0]
  81.   set maxFrames to 12
  82.   set x1List to [502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502]
  83.   set y1List to [80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80]
  84.   set the locH of sprite myChan2 to 460
  85.   set the locV of sprite myChan2 to 84
  86. end
  87.  
  88. on var3 me
  89.   set cast1List to [68, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 68]
  90.   set cast2List to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  91.   set maxFrames to 12
  92.   set x1List to [502, 497, 497, 497, 497, 497, 497, 497, 497, 497, 497, 502]
  93.   set y1List to [80, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 80]
  94. end
  95.