home *** CD-ROM | disk | FTP | other *** search
- property myChan1, myChan2, myChan3, maxFrames, currFrame, cast1List, cast2List, cast3List, castList, horizlocList, vertlocList, pos, state
-
- on birth me, chan1, chan2, chan3
- global firstTime
- set myChan1 to chan1
- set myChan2 to chan2
- set myChan3 to chan3
- set the stretch of sprite myChan1 to 0
- set the stretch of sprite myChan2 to 0
- set the stretch of sprite myChan3 to 0
- set state to #dontMove
- set horizlocList to [24, 245, 551, 420, 230]
- set vertlocList to [362, 147, 279, 158, 160]
- if firstTime then
- set pos to 1
- else
- set pos to random(count(horizlocList))
- end if
- set the locH of sprite myChan1 to getAt(horizlocList, pos)
- set the locV of sprite myChan1 to getAt(vertlocList, pos)
- set the locH of sprite myChan2 to getAt(horizlocList, pos) - 1
- set the locV of sprite myChan2 to getAt(vertlocList, pos)
- set the locH of sprite myChan3 to getAt(horizlocList, pos)
- set the locV of sprite myChan3 to getAt(vertlocList, pos)
- return me
- end
-
- on startAnimation me
- set state to #move
- set currFrame to 1
- set rand to random(2)
- if rand = 1 then
- set cast1List to [550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550]
- set cast2List to [551, 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, 551]
- set cast3List to [0, 0, 0, 0, 0, 568, 568, 0, 0, 568, 568, 0, 0]
- set maxFrames to count(cast1List)
- else
- set cast1List to [550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550]
- set cast2List to [551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567]
- set cast3List to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- set maxFrames to count(cast1List)
- end if
- end
-
- on Animate me
- if state = #dontMove then
- set rand to random(20)
- if rand = 1 then
- startAnimation(me)
- end if
- else
- if currFrame <= maxFrames then
- set cast1Index to getAt(cast1List, currFrame)
- set cast2Index to getAt(cast2List, currFrame)
- set cast3Index to getAt(cast3List, currFrame)
- set the castNum of sprite myChan1 to cast1Index
- set the castNum of sprite myChan2 to cast2Index
- set the castNum of sprite myChan3 to cast3Index
- else
- set the castNum of sprite myChan1 to 550
- set the castNum of sprite myChan2 to 551
- set the castNum of sprite myChan3 to 0
- set state to #dontMove
- end if
- set currFrame to currFrame + 1
- end if
- end
-