Game Development Reference
In-Depth Information
Figure 2.3 Painter's algorithm applied to a 2D space scene.
This can be implemented without much issue in a 2D game. Each sprite object can
have an integral draw order value, in addition to any other information such as im-
age file data and the sprite's x and y positions:
Click here to view code image
class Sprite
ImageFile image
int drawOrder
int x , y
function Draw()
// Draw the image at the correct (x,y)
...
end
end
Search WWH ::




Custom Search