Difference between revisions of "ResetAnimFrames (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 19: | Line 19: | ||
== Main Script == | == Main Script == | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
− | function | + | function resetAnimFrames(anim) |
ActiveAnimations[anim].FirstFrame = 1 -- update from animation frame range | ActiveAnimations[anim].FirstFrame = 1 -- update from animation frame range | ||
ActiveAnimations[anim].LastFrame = #Animations[anim].Sprites -- update to animation frame range | ActiveAnimations[anim].LastFrame = #Animations[anim].Sprites -- update to animation frame range |
Latest revision as of 20:25, 21 August 2022
Name | Type | By |
---|---|---|
resetAnimFrames("anim") | Definition | AFRLme |
This small function allows you to quickly reset the current frame range of an animation back to default animation frame range.
Instructions
1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2. Example: reset current animation frame range back to the default animation frame range.
resetAnimFrames("example")
Main Script
function resetAnimFrames(anim)
ActiveAnimations[anim].FirstFrame = 1 -- update from animation frame range
ActiveAnimations[anim].LastFrame = #Animations[anim].Sprites -- update to animation frame range
end
Syntax Breakdown
Name | Type | Description |
---|---|---|
anim | "string" | This should be a "string" value containing the name of the animation you want to reset the animation frame range of back to the default range. |