28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 16 ■ Collision Detection: Creating SVG Polygons for the Game Actors and Writing Code to Detect Collision<br />

Figure 16-37. Remove the private access control modifier keyword from in front of the StackPane root; <strong>Java</strong> statement<br />

Once you make this modification, you will see the wavy red error highlighting in your current programming<br />

statement in the Bagel.java disappear, as shown in Figure 16-38, and all we have to worry about now is removing the<br />

warning highlighting that pertains to passing an Actor object to be removed from the Scene Graph rather than a Node<br />

object (a spriteFrame ImageView) that it is expecting. This is because the <strong>Java</strong>FX Scene Graph manages Node classes,<br />

as well as Node subclasses such as ImageView, and does not accept non-Node-subclasses, such as the Actor class that<br />

we designed in Chapter 8, and have implemented during subsequent chapters. Our Actor class (object) does contain a<br />

Node object, an ImageView Node subclass, inside of it, so we have to include a reference to this object, using <strong>Java</strong> dot<br />

notation, so the .remove() method can effectively look “inside” of our Actor object to reach (access) this Node object.<br />

382<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!