Game Development Reference
In-Depth Information
Figure 2-2. Various shapes using Graphics API
Some of the shapes in Listing 2-2 are drawn via the built-in shape-drawing methods, but the triangle shows how you
can build custom shapes by creating paths. The moveTo method positions your path's starting point and the lineTo draws
the path to the specified x and y positions. Closing a path will use your previously defined fill color to fill it in.
You can essentially draw any shape you can imagine, but manually drawing these path coordinates can be pretty
tedious and complicated. If you plan on using some more interesting shapes in your game, you might want to check
out this really neat tool that will do the graphics code for you.
Drawscript
Drawscript is an extension that can be used to export graphics code from vector shapes drawn in Illustrator. It was
developed by Adobe gaming evangelist Tom Krcha and can be downloaded for free via the web site drawscri.pt
(see Figure 2-3 ). At the time of writing this topic, Drawscript is in beta and is actively being updated with more features.
Figure 2-3. Web site for Drawscript, an Ilustrator extenstion
 
Search WWH ::




Custom Search