Lingo, like every Programming Language includes structures that allow you to loop through a piece of code, such as the repeat loop. However, it should be used with care, as it may not even needed in many cases. For example, the repeat could be useful for performing calculations, searching through the items in a list, etc, but it is not useful (or safe) to use it for creating animation by replacing cast members in a sprite. Below are two implementations of a "Dancing Arthur". The right way to do is using the "slower dance" which takes advantage of the continuous play of a Director movie for the animation (instead of the "fast dance" which relies on a repeat loop.)
Shows
how animation can be performed in a single frame (marker "fastdance")
by rotating between cast members appearing in the channel. Why does the sampleImage rotate between 3 and 10? Watch
the animation carefully - do you really see 150
images of Arthur? The correct way to animate: Through frame movement. Play
the file under the marker "slowerdance" Both animations use a counter. Is this the very same counter? Why not? When is a global variable initialized? When you start a movie or every time you re-start a movie? Note that you can make the animations more funny if you randomize the outcome of the mod calculation before assigning it to sampleImage Also notice that you can make Arthur double-dance!
|
|
Maintained By: Takis Metaxas
|