|
Revision history:
- February 18, 1998 Add extra constructors and the ability to place one Actor behind another already
in the stage list.
- February 27, 1998 Fix a bug in move() that greatly improves the performance of the demos. New method getRect().
- March 10, 1998 Add move listeners and trackers.
- March 11, 1998 Add permanent data storage.
- April 8, 1998 - Rev 1.1 - Implement clocked operation. Extensive revision.
- September 17, 1998 - Replaced by linguist.quickshow.Actor.
An Actor is the base class for any object that is to be managed on a Stage. This includes
objects that have no visual representation. Using Actor as the base class ensures that the object is known to the
Stage and enables other Actor-derived objects to interact with it and send each other messages.
At its simplest, your Actor-derived class overrides the run()
method to perform initialization and background operations. Where it has a visual representation in the form of
one or more JPEG or GIF images, methods are available to load these images. Whenever an Actor moves or changes
the currently-viewed image it automatically updates its own invalid rectangle, so that when the Stage performs
its regular update this area will be included in the update. By this means, Actors are independent of each other
even where they overlap.
Actors implement a simple but effective messaging system that allows you to control their actions using simple
text commands. This usually avoids the need to directly access methods in derived classes, which aids readability
and portability.
Another useful feature of an Actor is its ability to track another Actor, so that movement of one results either
in a notification being sent to the other or in the other moving in step with the first. Trackers are very handy
in games that use a scrolling background.
Formal (javadoc) documentation
|