Game Development Reference
In-Depth Information
erencing (StackPane), as well as the traditional upper-left 0,0 screen location referen-
cing (a Group class as a Scene Graph root).
Removing a Node object from the Scene Graph root is done using a
.getChil-
dren().remove()
method chain, in the exact opposite fashion of the
.getChildren.add()
method call found in the .addGameActorNodes() method. Add a line of code, and type
invinciBagel.root
and a
period
, as shown in
Figure 16-35
, to open the method helper
pop-up.
Figure 16-35
.
Add a line of code under an .addToRemovedActors() method call and type invinciBagel.root and a
period
Since we are doing this ImageView Node removal from the Bagel.java class, we
will use Java dot notation to preface the root object with the invinciBagel object refer-
ence before we add the .getChildren() method call, using the following
invinciBa-
gel.root.getChildren()
code shown in
Figure 16-35
. Double-click on the
re-
move(Object o)
selection and add the object you passed into the .collide() method into
the .remove() method, as seen in
Figure 16-36
. This will create the final
invinciBa-
gel.root.getChildren().remove(object);
Java programming statement.