Game Development Reference
In-Depth Information
States
Animation states in Lua will be represented by a table with a few key pieces of informa-
tion. First, we need to store the animation, state name, whether the state is looping, and at
what rate the animation will be played. The ASM will contain one animation state for each
animation we support for our soldier.
Note
You can find the topic's implementation of an animation state in the src/
demo_framework/script/AnimationState.lua file.
Laying out the AnimationState class will create an initialization function which as-
signs default values for each instance of AnimationState .
Sandbox.lua :
AnimationState = {};
function AnimationState.new()
local state = {};
state.animation_ = nil;
state.name_ = "";
state.looping_ = false;
state.rate_ = 1;
return state;
end
Tip
Setting a Lua table value to nil will remove the value from the table, but it is helpful to doc-
ument exactly which variables we will be executing on.
Search WWH ::




Custom Search