Difference between revisions of "ResetAnimFrames (CMS)"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "{| class="ts" style="width:100%" |- ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By |- | resetAnimFrames("anim") || Definiti...")
 
Line 6: Line 6:
 
|}
 
|}
  
This small function allows you to quickly reset the frame range of an animation back to default animation frame range.
+
This small function allows you to quickly reset the current frame range of an animation back to default animation frame range.
  
  
 
== Instructions ==
 
== Instructions ==
 
1. Add the [[#Main_Script|main script]] to the Visionaire Studio Script Editor & set the script as a definition script.<br/>
 
1. Add the [[#Main_Script|main script]] to the Visionaire Studio Script Editor & set the script as a definition script.<br/>
2. Example: reset animation frame range back to the default animation frame range.
+
2. Example: reset current animation frame range back to the default animation frame range.
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
resetAnimFrames("example")
 
resetAnimFrames("example")

Revision as of 21:22, 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 resetFrames(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.