Game Development Reference
In-Depth Information
Figure 16-38 . Add a period after object in the .remove() method to open method helper and select .getSpriteFrame()
Place your cursor after the object reference that is inside of the .remove() method
call that we are working on implementing, and type a period . This will bring up the at-
tribute (property) and method helper pop-up, shown in Figure 16-38 . Double-click on
the getSpriteFrame() method, which we created back in Chapter 8 , to call it off of the
current Actor object which has been passed into the .collide() method. This will pass an
ImageView Node object over inside of the .remove() method call, as expected, and the
warning highlighting will also disappear, leaving clean code.
As you can see in Figure 16-39 , all of your Java code is error-free, and you have
now played a sound, added this Actor object to the HashSet<Actor>
REMOVED_ACTORS data set, and removed the spriteFrame ImageView Node object
for this Actor from the JavaFX Scene Graph root (currently a StackPane layout con-
tainer). We are now ready to remove this Actor object from the CURRENT_CAST
List<Actor> object, by using a .resetRemovedActors() method call.
 
 
Search WWH ::




Custom Search