Game Development Reference
In-Depth Information
function Agent_HandleEvent(agent, event)
if (event.source == "keyboard" and event.pressed) then
if ( event.key == "f2_key" ) then
_soldierAsm:RequestState(
Soldier.SoldierStates.STAND_FIRE);
-- Disable moving while shooting.
agent:SetMaxSpeed(0);
end
end
end
The program, when executed, makes our agent shoot, as shown in the following screen-
shot:
Search WWH ::




Custom Search