![]() |
![]() |
home |
The basic movement is governed by the custom functions: private function turn(){and private function move(){ which were both written by Scott. These govern the movement and rotation of the fish, as well as the swapping of the swim animation to reflect different movement speeds. The interactive functions are very similar to those used in the Eye. Basically, each fish has a 'destination point' on the stage that it swims toward, starting at a higher speed and algorithmically decelerating as it gets closer. This destination point is programmed to wander randomly at a very low speed. If the fish manages to get close enough this point, a new point is chosen. Since the fish's movement speed decreases in direct proportion to its proximity, this is a rough example of Zeno's Paradox. While this poses the risk of collapsing linear time, we sidestep this problem by setting a distance threshold of 9 pixels that triggers choosing a new destination point. As an added bonus, we get a neat little behavior where the fish seems to linger at its destination as if it found something of interest there before it gets "bored" and moves on. |
Last Update Date: March 15, 2005
![]() This work is licensed under a Creative Commons License. |
|