Click a fish to remove it. Click elsewhere to spawn a new fish at that location.
This movie has a behaviour called "FishTank_behaviour" that provides the main interface to the fishtank system. This behaviour instantiates objects from the "Fish_Class", "Bubble_Class" and "Explosion_Class" scripts and stores these objects in a list called "myObjects". Every enterframe, this behaviour will tell all the objects stored in the myObjects list to update themselves by sending a #mUpdate message. When those objects update themselves, they may respond by sending a message back to this 'fishtank' object, such as #mSpawnObject, #mShowObjectInWorld or #mDeleteObject. A fish object will respond to an #mUpdate message by firstly changing its location, then sending a #mShowObjectInWorld message back to the tank object telling it to draw the fish in a new position. The fish object might also decide to blow some bubbles. If it does, it will tell the tank object to spawn a new bubble object at a specified location using the #mSpawnObject method. Bubble Objects will respond to the #mUpdate message by moving towards the top of the tank and telling the tank object to draw them at a new locaton. When the bubbles reach the top of the tank, they will send a message back to the tank telling the tank object to delete them. When the fish and bubbles (etc) tell the tank object to show their image (using the #mShowObjectInWorld method), their images are drawn into an off-screen buffer ("myBuffer"). Before drawing the buffer to the stage, the fishtank object passes the buffer image to the Rippler Object, a utility object which is used to create the final visual "ripple" effect.