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-16. Import the latest SVG data with data triplets deleted into GIMP to see curve without tension handle data<br />

The solution to turn these non-conforming (to the sprite outline) curves into the same collision polygon that we<br />

had before is quite simple, and you may have already guessed what it is. Since we want straight lines between our<br />

data points, we need to change this “C” to an “L.” This will turn a curveto SVG command into a lineto SVG command.<br />

As you can see in Figure 16-17, our collision polygon data is almost where we expected it to be, containing 16<br />

data point pairs and a Z closing command to create a 16-sided collision polygon. We can remove the first duplicate<br />

data pair, reducing the data set to 15 data point pairs, which is what we “laid down” in GIMP. Next, let’s again use our<br />

Import Path work process in GIMP, and see if we get the same square polygon result that is shown in Figure 16-14.<br />

360<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!