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-17. Change your SVG Path data from using the C (curve) data type to the L (line) data type representation<br />

The final SVG data set is shown in Figure 16-18, and you can copy and paste that data into your <strong>Java</strong> code as well<br />

as into an empty Notepad document and save it as its own file, named iBshape1svg.txt, so that we can do some math<br />

next, and see exactly how much data we have reduced our collision polygon from the automatic GIMP created collision<br />

polygon, to our hand-optimized custom collision polygon. If you import the collision data shown in Figure 16-18 in<br />

GIMP, you will get the desired collision polygon shown in Figure 16-14 with 15 data point pairs, instead of 100!<br />

Figure 16-18. To use optimized SVG Path data set, select the part after d= (including quotes), and paste into the code<br />

www.it-ebooks.info<br />

361

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

Saved successfully!

Ooh no, something went wrong!