Game Development Reference
In-Depth Information
Figure 14-21
.
Instantiate an iPR0 Prop object, add it to the root Scene Graph, and add it to the CurrentCast
List<Actor>
The next step is to add the ImageView
Node
object for the iPR0 Prop object to the
Scene Graph
root
object. This is done using a
.getChildren().add()
method chain,
which references the
spriteFrame
ImageView object, inside of the
iPR0
Prop object
using dot notation
, using the following Java statement, which is also shown in
Figure
root
.getChildren().add(
iPR0.spriteFrame
);
Next, use an .addCurrentCast() method to add an iPR0 object to a castDirector ob-
ject, seen in
Figure 14-21
:
castDirector
.addCurrentCast(
iPR0
);
Next, test the code using a
Run
Project
work process. The results are seen on
the left side of
Figure 14-22
.