Game Development Reference
In-Depth Information
Figure 16-39 . Remove the currently collided with Actor object ImageView Node from the Scene Graph using .re-
move()
After we update the CURRENT_CAST List, we will have done our basic collision
management coding, and we can take a look at how we can optimize the .checkColli-
sion() and .collide() methods to work together more efficiently.
Reset the Removed Actor List: .resetRemovedActors()
Method
The final thing that we need to do in the series of programming statements that need to
happen when a collision occurs is to reset the REMOVED_ACTORS HashSet<Actor>
object. As you recall from Chapter 10 , this method removes the removed actors from
the CURRENT_CAST List<Actor> object, so that the Actor object is completely re-
moved from the game entirely. Besides the .playiSound0() method call we are using to
test this method using our ears, this is one of the simplest Java programming statements
that we will have to code, and should look like the following Java code:
invinciBagel.castDirector. resetRemovedActors() ;
 
Search WWH ::




Custom Search