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-4. Right-click on Selection Path in Paths Palette, and Export Path<br />

In the other floating palette, click on the Paths Tab, shown on the right side of Figure 16-4. GIMP has two,<br />

primary floating tool windows; one is the GIMP Toolbox, containing Tools, Options, Brushes, Patterns, and<br />

Gradients, and the other contains four tabs, which represent your digital image’s compositing Layers, Channels,<br />

Selection Paths, and even an Undo Buffer, which gives you a “history” of every “move” you have made in GIMP since<br />

you launched it.<br />

Select the Path named Selection (the Path layer named Selection will then turn blue). Next right-click on the<br />

Path named Selection, and at the bottom of that menu of things that you can do to the Selection Path, you will see an<br />

Export Path menu option. This is another one of the key GIMP algorithms that enables this collision polygon creation<br />

and output work process for us.<br />

Selecting this Export Path option will export the current InvinciBagel character Selection Path data for us, as a<br />

text-based (XML) file containing SVG data, which is what we need to use in our Bagel() constructor method call. This<br />

data will be contained in the first String SVGdata parameter, and will replace our “dummy data” that we have been<br />

using as a placeholder thus far.<br />

Once you invoke the Export Path menu option, you will see the Export Path to SVG dialog, which is shown in<br />

Figure 16-5. As you can see, I’ve selected the “Export the active path” option, at the bottom of the dialog, since I only<br />

want to have one collision polygon path data object, and I am naming this file sprite1svgdata.svg, and I am saving it<br />

in my C:\Clients\BagelToons\InvinciBagelGame\Shape_Data folder.<br />

www.it-ebooks.info<br />

349

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

Saved successfully!

Ooh no, something went wrong!