Balls and Blocks

These applets are my first experiment with OOP in Java. A fairly simple animation loop runs a collection of Actor objects. Different types of actor are derived from this base abstract class. Since all of these classes are derived from Actor, an iterator can run through all of the objects and call the move() and draw() methods on every object.

In the top right corner of each of the demonstrations is a counter showing how many actors are in the collection. When an actor dies it flags itself as capable of being removed from the collection. When an actor wants to add more objects to the collection, it can pass the list of objects out to the iterator which will then add them to the Actor collection.