Game Development Reference
In-Depth Information
Figure 16-26 . Comment out code related to iP1 object in addGameActorNodes() and createCastingDirection() meth-
ods
After you update your iBagel Bagel() constructor method, with accurate SVG data
for your collision polygon, update the iP0 fixed Actor props, using the coordinates for
the four corner pixels, to create a square collision polygon, as can be seen in Figure
16-25 . The upper-left origin corner for any image is going to be 0,0 , so the first SVG
command is going to be M0,0 , or “moveto origin.” Next, we want to draw a “lineto”
using the L command, the lower-left corner, which would use the L0,32 command and
data set, since this brick image is 32 pixels tall (Y), and 72 pixels wide (X).
The next data pair will not need to be prefaced by an L command, since any imple-
mentation of an SVG data parsing algorithm will assume the command used for the
previous data pair, if none has been explicitly specified. Your lower-right corner of the
brick image will use X,Y coordinate 72,32 . The upper-right corner of this image would
use X,Y coordinate 72,0 . The Z command can be used to connect the upper-right
corner of this prop image with the origin, so that we have collision detection on the top
of the brick, in this particular use-case, using a closed polygon. As you can see in Fig-
ure 16-25 , you can either use commas or spaces with SVG data, so both of these meth-
od calls should work:
 
Search WWH ::




Custom Search