Game Development Reference
In-Depth Information
Figure 14-23
.
Instantiate an iPH0 PropH object, add it to the root Scene Graph, and add it to a CurrentCast
List<Actor>
Our next step in adding a fixed sprite prop, is adding the ImageView
Node
object
for the iPH0 PropH object, into the Scene Graph
root
object. This is accomplished us-
ing the
.getChildren().add()
method chain, which references the
spriteFrame
ImageView object that lives inside of the
iPH0
PropH object, by using dot notation.
This is done using the following Java statement, which is also shown in
Figure 14-23
:
root
.getChildren().add(
iPH0.spriteFrame
);
Finally, we will use the
.addCurrentCast()
method that we created in
Chapter 10
,
to add this
iPH0
object to the CURRENT_CAST List<Actor> ArrayList object, inside
of the castDirector CastingDirector object, using the following line of Java code, also
shown at the bottom of
Figure 14-23
:
castDirector
.addCurrentCast(
iPH0
);
As you can see in
Figure 14-23
, I have also changed the
0,0
coordinates for the
Prop object to
0,148
, and the coordinates for the PropH object to
72,148
. This will
place the
Y-axis mirrored PropH
object seamlessly to the right of the Prop object. If
you want to see the seamless tiling effect now, you can use your
Run Project
work
process. If you don't have your NetBeans 8 IDE running currently, and you want to
look ahead to
Figure 14-26
, you can see this tiling (mirroring) effect now. Eventually,
I'm also going to integrate the PropV and the PropB classes (objects) into this tiling.