Game Development Reference
In-Depth Information
And in the Update function, add the following:
We have one state left. Add another class and call it FleeState.vb. Make it inherit
from BasicState the same way you did for the prior two states. In the Entry
routine, add the following:
World.Say("Feet, don't fail me now!")
In the ExitFunction routine, add the following:
World.Say("I better slow down.")
And in the Update function, add the following:
World.Say("Run away! Run away!")
This would be a really good time to go to the File menu and choose Save All.
All three states are defined, but they are not complete. There are no transitions
defined, and this makes it impossible for the states to load their transitions. We
will store our transitions in the same file that holds the state the transition is
from. We start with HidingState . Go to the End Class statement. Hit the End key
on your keyboard or click at the end of the line and then press Enter twice. Now
type the following line and press Enter:
Public Class SeePlayerHighHealthTxn
VB nicely adds the End Class statement for you. Exactly as HidingState inherits
from BasicState , this transition needs to inherit from BasicTransition . Add the
following line inside the class and press Enter:
Inherits BasicTransition
VB again provides the required skeleton.
Note the squiggly line under the End Function statement. This indicates a
problem. Hover your mouse over that line, and Visual Basic will tell you what
the problem is. You can easily miss the marking, however; fortunately, Visual
it, open the View menu and select Error List. The Error List window docks at
the bottom of the environment, listing errors, warnings, and informative
Search Nedrilad ::

Custom Search