Difference between revisions of "ChangeScene (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 |- | changeScene("s", t, d) || Definitio...")
 
Line 32: Line 32:
 
2. To change the current scene...
 
2. To change the current scene...
 
<syntaxhighlight>
 
<syntaxhighlight>
changeScene("scene_name", 0, 500)
+
changeScene("scene_name", 3, 500) -- fade in/out over 500ms
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 20:05, 25 September 2014

Name Type By
changeScene("s", t, d) Definition AFRLme

This small function allows you to change to another scene, define the scene transition effect & transition time.

Transition Values
0: no transition (immediate).
1: fade in.
2: fade out.
3: fade in/out.
4: fade in/out (with alpha blending).
5: wipe left.
6: wipe right.
7: fade in/out (circle).

Instructions

1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2. To change the current scene...

changeScene("scene_name", 3, 500) -- fade in/out over 500ms

Main Script

function changeScene(s, t, d, fe, fd)
 fe = game:getInt(VGameFadeEffect); fd = game:getInt(VGameFadeDelay)
 -- + --
 if t < 0 then t = 0 elseif t > 7 then t = 7 end
 game:setValue(VGameFadeEffect, t); game:setValue(VGameFadeDelay, d)
 -- + --
 game:setValue( VGameCurrentScene, getObject("Scenes[" .. s .. "]") )
 -- + --
 game:setValue(VGameFadeEffect, fe); game:setValue(VGameFadeDelay, fd)
end

Syntax Breakdown

Name Type Description
"s" "string" This should be a "string" value containing the name of the scene you want to change to.
t integer This should be an integer value between 0 & 7, which will determine the transition effect.
d integer This should be an integer value containing the transition time between scenes, in milliseconds. (only affects transitions 1-7)