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

  1. property myChan1, myChan2, maxFrames, currFrame, cast1List, cast2List, x2List, y2List, var, state
  2.  
  3. on birth me, chan1, chan2
  4.   set myChan1 to chan1
  5.   set myChan2 to chan2
  6.   set state to #dontMove
  7.   set the stretch of sprite myChan1 to 0
  8.   set the stretch of sprite myChan2 to 0
  9.   return me
  10. end
  11.  
  12. on startAnimation me
  13.   set var to random(3)
  14.   do("var" & var & " me")
  15.   set state to #move
  16.   set currFrame to 1
  17. end
  18.  
  19. on var1 me
  20.   set cast1List to [204, 206, 206, 206, 206, 205, 205, 205, 205, 205, 205, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 205, 205, 205, 205, 205, 205, 205, 205, 205, 206, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204]
  21.   set x2List to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  22.   set y2List to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  23.   set cast2List to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  24.   set maxFrames to count(cast2List)
  25.   set the locH of sprite myChan1 to 608
  26.   set the locV of sprite myChan1 to 246
  27. end
  28.  
  29. on var2 me
  30.   set the foreColor of sprite myChan2 to getAt([20, 37, 85, 97, 113, 141, 162, 244], random(8))
  31.   set cast1List to [204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204]
  32.   set x2List to [584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584]
  33.   set y2List to [209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209]
  34.   set cast2List to [191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 200, 200, 200, 200, 201, 202, 203, 203, 203, 203, 203, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191]
  35.   set maxFrames to count(cast2List)
  36.   set the locH of sprite myChan1 to 608
  37.   set the locV of sprite myChan1 to 246
  38. end
  39.  
  40. on var3 me
  41.   set the foreColor of sprite myChan2 to 255
  42.   set cast1List to [204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, 221, 221, 218, 218, 218, 218, 218, 218, 204, 204, 204, 204, 204, 204, 204, 204, 222, 220, 219, 220, 219, 220, 220, 220, 220, 220, 219, 219, 218, 221, 218, 219, 219, 218, 218, 219, 219, 218, 218, 219, 219, 218, 218, 222, 220, 219, 219, 219, 219, 219, 219, 219, 220, 222]
  43.   set x2List to [631, 631, 626, 622, 618, 615, 611, 608, 609, 610, 614, 617, 622, 623, 622, 619, 614, 613, 616, 616, 612, 612, 617, 620, 619, 616, 614, 611, 607, 602, 595, 594, 593, 600, 604, 608, 613, 616, 621, 621, 616, 614, 608, 602, 599, 601, 609, 610, 614, 611, 608, 611, 620, 622, 623, 622, 622, 621, 622, 624, 627, 628, 627, 620, 618, 622, 632, 634, 635, 626, 623, 626, 637, 640, 636, 629, 629, 616, 612, 613, 618, 624, 611, 607, 611, 619, 616, 613, 617, 621, 617, 612, 612, 629, 639, 643, 646, 637, 627, 619, 634, 643, 652, 659]
  44.   set y2List to [2, 2, 7, 13, 21, 27, 35, 47, 56, 63, 73, 78, 84, 88, 92, 92, 90, 84, 81, 84, 88, 90, 96, 104, 117, 128, 132, 128, 124, 126, 133, 138, 143, 138, 143, 144, 152, 154, 160, 160, 166, 168, 172, 169, 172, 178, 183, 185, 187, 194, 196, 193, 166, 159, 158, 160, 174, 179, 183, 175, 176, 184, 192, 193, 199, 201, 205, 210, 212, 211, 211, 213, 203, 194, 185, 177, 171, 181, 182, 170, 172, 174, 183, 187, 188, 186, 195, 198, 199, 201, 204, 209, 208, 198, 190, 187, 193, 196, 191, 193, 187, 184, 184, 185]
  45.   set cast2List to [184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223, 184, 223]
  46.   set maxFrames to count(cast2List)
  47.   set the locH of sprite myChan1 to 608
  48.   set the locV of sprite myChan1 to 246
  49. end
  50.  
  51. on Animate me
  52.   if state = #dontMove then
  53.     set rand to random(3)
  54.     if (rand = 1) or (rand = 2) then
  55.       startAnimation(me)
  56.     end if
  57.   else
  58.     if currFrame <= maxFrames then
  59.       set cast1Index to getAt(cast1List, currFrame)
  60.       set the locH of sprite myChan2 to getAt(x2List, currFrame)
  61.       set the locV of sprite myChan2 to getAt(y2List, currFrame)
  62.       set cast2Index to getAt(cast2List, currFrame)
  63.       set the castNum of sprite myChan1 to cast1Index
  64.       set the castNum of sprite myChan2 to cast2Index
  65.     else
  66.       set the castNum of sprite myChan1 to 204
  67.       set the castNum of sprite myChan2 to 0
  68.       set state to #dontMove
  69.     end if
  70.     set currFrame to currFrame + 1
  71.   end if
  72. end
  73.