Building a Tree Limb


Class Diagrams for Trees3D

Figure 28-2 shows the class diagrams for the TRees3D application. The class names and public methods are shown.

trees3D is the top-level JFrame for the application, and WrapTrees3D sets up the scene. It initially creates five treeLimb objects, representing five tree limbs. New limbs sprout from these, creating trees like those in Figure 28-1.

TReeLimb encodes the animation component, so it offers many methods for changing a limb (e.g., making it grow longer, thicker, and changing color). The leaves at the end of a tree limb are represented by two ImagesCsSeries screens that show pictures of leaves. The images can be changed to give the effect the leaves are changing.

The rules are implemented in the GrowthBehavior object and evaluated every 100 ms.

Figure 28-2. Class diagrams for Trees3D


The application can be found in the Trees3D/ directory.




Killer Game Programming in Java
Killer Game Programming in Java
ISBN: 0596007302
EAN: 2147483647
Year: 2006
Pages: 340

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net