Game Development Reference
In-Depth Information
void RunCombatNode()
{
if(FightsRanged)
RangedAttack();
else
MeleeAttack();
}
void RunFleeNode()
{
Flee();
}
Two of the three boolean variables we just created are being used as conditionals
to call different functions, effectively creating finite state machines. Next, we will be
adding the rest of our actions; these are what is being called by the middleman func-
tions. Some of these functions will be empty placeholders, but will be filled later on
in the chapter:
void Idle()
{
}
void Guard()
{
if(isSuspicious)
{
SearchForTarget();
}
else
{
Patrol();
}
}
void Combat()
{
Search WWH ::




Custom Search