28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Figure 16-46. Add a private void scoringEngine(Actor object) empty method, and call if inside .checkCollision()<br />

method<br />

We’ll do this in the next chapter, so we don’t have to worry about that warning from NetBeans, and we have our<br />

scoring engine infrastructure in place.<br />

You’ve accomplished a lot in this chapter, regarding collision detection and your scoring engine. Good Job!<br />

Summary<br />

In this sixteenth chapter, we started in on some of the more advanced topics that we will be covering during the last<br />

couple of chapters in this book. Collision detection is one of the foundational topics of game development, whether<br />

this is using <strong>Java</strong> 8, or any other platform, for that matter. In this chapter we learned about the SVG data format<br />

specification, so that we can leverage the <strong>Java</strong>FX SVGPath class, which allows us to access custom path shapes, often<br />

called polygons, if they are closed, and which collision shapes, or collision polygons, usually are. We looked at the<br />

seven primary commands within the SVG specification, all of which can be used in absolute or relative mode.<br />

Next we took a detailed look at how to get GIMP 2.8 to create custom collision shape SVG data strings for us using<br />

a fully automated process that uses only GIMP tools (algorithms) to allow us to simply click on transparent areas and<br />

have GIMP generate the selection set. We converted the selection set into a collision path, and then exported the path<br />

as SVG data. This work process allows us to generate complex collision polygons with transparent (alpha channel<br />

data) areas within any of the game asset digital images.<br />

390<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!