| | | Images and Active Objects - putting it all together |
Images and Active Objects - putting it all together
The code for program
Falling Leaves
includes object fallingLeaves
which inherits graphicApplication. While it includes code for
loading the images of the leaves, and draws the background picture,
the only indication that something interesting is going on is in the
method onMouseClick. Each time the mouse is clicked, a new
object of type tree is created. Obviously this tree object
is responsible for the cascade of leaves which show up on the screen. In
fact we see that the images of leaves are passed along to the
tree constructor. Understanding the way this works is key to
being able to write programs like the Frogger lab, which is coming up soon!.
| | | Images and Active Objects - putting it all together |