Game Development Reference
In-Depth Information
if (currSegment != dir+4) setAnimationSegment(dir+4);
return ret;
}
The following direction constants can be used to define the 4 basic movement directions in
the Canvas Coordinate System (figure 3.1), i.e.
0 - DIR_DOWN
1 - DIR_LEFT
2 - DIR_RIGHT
3 - DIR_UP
An object is only allowed to move within the area of the canvas, a rectangle 2D coordinate
system. Unlike in math the origin is at the top left corner. So for the object to start from the
top left corner of the screen its coordinate is (0,0). To accomplish a movement from (1,1)
to (2,3), the direction combination should be 2-right and 0-down.
Figure 3.1 Canvas Coordinate System
Bitmap Sheet
Search WWH ::




Custom Search