
262 9. Enhanced Appearance
e four possible draws of the space image are highlighted in the render function. e
spaceship is always drawn aer the space images so it appears on top of the background.
9.2 Painter’s Algorithm
In a 3D game, the graphics system uses the coordinates of items so that nearby items are
always drawn in front of far away items. In a 2D game, the items typically only have a
horizontal and a vertical position but no depth. When we display overlapping 2D items, we
need some way to determine which items are drawn in front and which items are drawn in
back. For that we will rely on a simple technique called the painter’s algor ...