Graphics Programs Reference
In-Depth Information
Figure 6-7
.
Spawning enemies
As we have modeled the Enemy object in Blender, we can obtain its center -
{10.0005, 10.0, 0.1005}
by reading the global median value from the
prop-
erties shelf
, as shown in Figure 5-9.
Here, the static field
_enemies
is initialized as:
private static List<Enemy> _enemies = new
ArrayList<Enemy>(10);
Although the
_enemies ArrayList
is initialized with an initial capacity of ten,
this
ArrayList
is used in the Renderer class.
Recall that in the
Tank Fence
game, the player has to guard the (white) square region
against Enemy objects. Because of the way this object has been modeled in Blender
(Figure 5-9), its default position upon rendering is as shown in
Figure 6-6
. So, we
need to push the Enemy objects away from the white region—as shown in
Figure
6-7
. As you may have guessed, the way we do this is by translating these objects.
the
onDrawFrame()
method, Renderer class).

Search WWH ::

Custom Search