Game Development Reference
In-Depth Information
Figure 12-5. The playing field
Everything in our world will happen inside this boundary in the x-z plane. Coordinates will be
limited on the x axis from −14 to 14 and on the z axis from 0 to −15. The ship will be able to
move along the bottom edge of the playing field, from (−14,0,0) to (14,0,0).
Next, we define the sizes of the objects in our world:
ï?®
The ship will have a radius of 0.5 units.
ï?®
The invaders will have a slightly larger radius of 0.75 units. This makes them
easier to hit.
ï?®
The shield blocks each have a radius of 0.5 units.
ï?®
The shots each have a radius of 0.1 units.
How did we arrive at these values? We simply divided up our game world in cells of 1 unit by
1 unit and determined how big each game element should be in relation to the size of the playing
field. Usually, you'd arrive at these measurements through a little experimentation, or by using
real-world units like meters. In Android Invaders, we'll use nameless units.
The radii we just defined can be directly translated to bounding spheres, of course. In the
case of the shield blocks and the ship, we can cheat a little, as those are clearly not spherical.
Thanks to the 2D properties of our world, we can get away with this little trick. In the case of the
invaders, the sphere is actually a pretty good approximation.
We also have to define the velocities of our moving objects:
ï?®
The ship can move with a maximum velocity of 20 units per second. As in
Super Jumper, we'll usually have a lower velocity, as it is dependent on the
device's tilt.
ï?®
The invaders initially move 1 unit per second. Each wave will slightly
increase this speed.
ï?®
The shots move at 10 units per second.
Search WWH ::




Custom Search