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-32. Creating the basic collision detection code and testing it using the invinciBagel.playiSound0() method call<br />

Now we’re ready to add the <strong>Java</strong> code that manages the CastingDirector object, to remove the Actor object.<br />

If Collision Detected: Manipulating the CastingDirector Object<br />

Add a line of code under the .playiSound0() method call, accessing the CastingDirector object, invinciBagel.<br />

castDirector. Next type a period key, to access a method helper pop-up, seen in Figure 16-33, and select<br />

.addToRemovedActors().<br />

378<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!