Game Development Reference
In-Depth Information
weaponAsm:RequestState("sniper_reload");
end
elseif (IsNumKey(event.key, 3)) then
if (weaponState == "sniper") then
if
(soldierAsm:RequestState("smg_transform")) then
weaponAsm:RequestState("smg_transform");
weaponState = "smg";
end
end
elseif (IsNumKey(event.key, 4)) then
if (weaponState == "smg") then
if (soldierAsm:RequestState(
"sniper_transform")) then
weaponAsm:RequestState("sniper_transform");
weaponState = "sniper";
end
end
elseif (IsNumKey(event.key, 5)) then
soldierAsm:RequestState("fire");
elseif (IsNumKey(event.key, 6)) then
soldierAsm:RequestState("run_forward");
elseif (IsNumKey(event.key, 7)) then
soldierAsm:RequestState("run_backward");
elseif (IsNumKey(event.key, 8)) then
soldierAsm:RequestState("dead");
elseif (IsNumKey(event.key, 9)) then
soldierAsm:RequestState("dead_headshot");
end
end
end
As we want both the soldier's ASM and the weapon's ASM to return their idle states
whenever a new state hasn't been requested, we can add a check during the update loop to
request their idle states, if required:
Search WWH ::




Custom Search