28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

Figure 16-36. Investigate red error highlight under the Scene Graph root StackPane object reference in the method call<br />

Mouse-over the warning highlighting, and you will see that NetBeans sees that we are passing our custom Actor<br />

object to the .getChildren().remove() method chain, instead of the ImageView Node object. The error message also<br />

tells us that the private StackPane root; declaration in our InvinciBagel.java class will not allow us to access this<br />

object, until we remove this private access control modifier keyword. Let’s fix the most serious (error) problem first,<br />

and then fix the “Suspicious method call to java.util.Collection.remove” after that by using an<br />

object.getSpriteFrame() method call, inside of the current .remove() method call.<br />

Click on the InvinciBagel.java editing tab in NetBeans and remove the private keyword from the front of the<br />

StackPane root; object declaration, as is shown highlighted in Figure 16-37.<br />

www.it-ebooks.info<br />

381

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

Saved successfully!

Ooh no, something went wrong!