Game Development Reference
In-Depth Information
The move behavior
If our agent is unable to pursue an enemy and isn't fleeing, a general move behavior should
operate on any target position our agent is currently moving toward. As target positions are
only set by random move actions, the move behavior must have higher priority than a ran-
dom move action; otherwise our agent will never be able to act on its target position:
SoldierLogic.lua :
function SoldierLogic_BehaviorTree(userData)
...
-- move action
node = node:GetParent();
node = node:GetParent();
node = node:GetParent();
child = CreateSequence();
node:AddChild(child);
node = child;
child = CreateCondition(
"has move position",
SoldierEvaluators_HasMovePosition);
node:AddChild(child);
node = child;
node = node:GetParent();
child = CreateAction(
"move to position", MoveAction(userData));
node:AddChild(child);
node = child;
return tree;
end
Search WWH ::




Custom Search