Game Development Reference
In-Depth Information
resolution; if you're targeting tablets specifically, you may want to use a resolution such as
800×1280, or perhaps something in between, such as 480×800 (a typical Android handset).
Regardless of your target resolution, the principals remain the same.
The next thing we have to do is establish a correspondence between pixels and meters in our
world. The mock-up in Figure 9-1 gives us a sense of how much screen space the different
objects use, as well as their proportions relative to each other. We recommend choosing a
mapping of 32 pixels to 1 meter for 2D games. So let's overlay our mock-up, which is
320×380 pixels in size, with a grid where each cell is 32×32 pixels. In our world space, this
would map to 1×1-meter cells. Figure 9-3 shows our mock-up and the grid.
Figure 9-3. The mock-up overlaid with a grid. Each cell is 32×32 pixels and corresponds to a 1×1-meter area in the
game world
We cheated a bit in Figure 9-3 . We arranged the graphics in a way so that they line up nicely with
the grid cells. In the real game, we'll place the objects at noninteger positions.
So, what can we make of Figure 9-3 ? First of all, we can directly estimate the width and height
of each object in our world in meters. Here are the values we'll use for the bounding rectangles
of our objects:
Bob is 0.8×0.8 meters; he does not entirely span a complete cell.
ï?®
A platform is 2×0.5 meters, taking up two cells horizontally and half a cell
ï?®
vertically.
A coin is 0.8×0.5 meters. It nearly spans a cell vertically and takes up
ï?®
roughly half a cell horizontally.
 
Search WWH ::




Custom Search