Game Development Reference
In-Depth Information
Now that there are a few states on the diagram, check if there are any flows you can
add that go back from each state to a previous one. You got to the
HaveGun
state by picking
up a weapon. It may also be possible to go back to the
NoGunNoAmmo
state by dropping
the weapon. Likewise, there should be a flow from
HaveAmmo
going back to
NoGunNoAmmo
when the player somehow drops his ammo. If there are multiple ways to do this, each
should appear on your TFD. One way might be to remove the ammo from your inven-
tory and another might be to perform a reload function. For this example, just add the
generic
DropAmmo
event and its companion
DropSound
action. To illustrate how actions
might be reused within a TFD, the diagram reflects that the same sound is played for
dropping either a weapon or ammo. That means the
DropGun
event will also cause the
DropSound
action. The return flows from
HaveGun
and
HaveAmmo
are shown in Figure 11.8.
Figure 11.8
Return flows added from
HaveGun
and
HaveAmmo
.
Now that the test represents gun-only and ammo-only states, tie the two concepts
together by grabbing ammo once you have the gun. Call the resulting state
HaveGunHaveAmmo
. You should recognize that picking up the gun once you have the ammo
will also take you to this very same state. Figure 11.9 shows the new flows and the
HaveGunHaveAmmo
state added to the TFD.
You may have noticed that when new states are added it's good to leave some room on
the diagram for flows or states that you might decide to add when you get further into
the design process. Use up some of that empty space now by doing the same thing for
HaveGunHaveAmmo
that you did with the
HaveAmmo
and
HaveGun
states: create return flows to
represent what happens when the gun or the ammo is dropped. One question that