Game Development Reference
In-Depth Information
Figure 16-37 . Remove the private access control modifier keyword from in front of the StackPane root; Java state-
ment
Once you make this modification, you will see the wavy red error highlighting in
your current programming statement in the Bagel.java disappear, as shown in Figure
16-38 , and all we have to worry about now is removing the warning highlighting that
pertains to passing an Actor object to be removed from the Scene Graph rather than a
Node object (a spriteFrame ImageView) that it is expecting. This is because the
JavaFX Scene Graph manages Node classes, as well as Node subclasses such as
ImageView, and does not accept non-Node-subclasses, such as the Actor class that we
designed in Chapter 8 , and have implemented during subsequent chapters. Our Actor
class (object) does contain a Node object, an ImageView Node subclass, inside of it, so
we have to include a reference to this object, using Java dot notation, so the .remove()
method can effectively look “inside” of our Actor object to reach (access) this Node
object.
 
 
Search WWH ::




Custom Search