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-24. Copy and paste your 15 data point collision polygon SVG data in place of dummy data in Bagel()<br />

method<br />

We will also use the <strong>Java</strong> code commenting technique that we learned in Chapter 3 to remove (temporarily) the<br />

larger mossy rock props from the Scene, and get our code to that place where we have the InvinciBagel character, and<br />

several bricks, on the Stage. We can then use these basic objects to start our code development concerning using the<br />

.collide() method and how it will use the castDirector CastingDirector class (object) as a collision processing guide.<br />

If you want to see the iPR1 and iPV1 objects temporarily removed from your .createGameActors() as well as your<br />

.addGameActorNodes() and .createCastingDirection() methods, you can see this <strong>Java</strong> code commenting in place<br />

in Figures 16-25 and 16-26. Next, let’s copy and paste the SVG collision polygon data set that you created earlier in the<br />

chapter. Open the iBshape1svg.txt file, shown in Figure 16-20, and select and copy the SVG data, using the Edit ➤<br />

Copy menu sequence or CTRL-C keyboard shortcut. Be sure to including the quotation marks. Paste the data in your<br />

Bagel() method in the .createGameActors() method where the dummy SVG data used to be, as seen in Figure 16-24.<br />

366<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!