Difference between revisions of "ChangeScene (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m |
|||
Line 11: | Line 11: | ||
! Transition Values | ! Transition Values | ||
|- | |- | ||
− | | [0] eFadeNo: no transition (immediate). | + | | [0] <span class="inlinecode">eFadeNo</span>: no transition (immediate). |
|- | |- | ||
− | | [1] eFadeIn: fade in. | + | | [1] <span class="inlinecode">eFadeIn</span>: fade in. |
|- | |- | ||
− | | | + | | [2] <span class="inlinecode">eFadeOut</span>: fade out. |
|- | |- | ||
− | | [3] eFadeInAndOut: fade in & out. | + | | [3] <span class="inlinecode">eFadeInAndOut</span>: fade in & out. |
|- | |- | ||
− | | [4] eFadeToNew: fade to new scene (blending). | + | | [4] <span class="inlinecode">eFadeToNew</span>: fade to new scene (blending). |
|- | |- | ||
− | | [5] eShiftLeft: wipe left. | + | | [5] <span class="inlinecode">eShiftLeft</span>: wipe left. |
|- | |- | ||
− | | [6] eShiftRight: wipe right. | + | | [6] <span class="inlinecode">eShiftRight</span>: wipe right. |
|- | |- | ||
− | | [7] eTunnelEffect: tunnel fade in & out (circle). | + | | [7] eTunnelEffect</span>: tunnel fade in & out (circle). |
|- | |- | ||
− | | [8] eFadeShader: requires a shader to be linked via <span class="inlinecode">shaderSetOptions()</span>. | + | | [8] <span class="inlinecode">eFadeShader</span>: requires a shader to be linked via <span class="inlinecode">shaderSetOptions()</span>. |
|- | |- | ||
− | | [9] eShiftUp: wipe up. | + | | [9] <span class="inlinecode">eShiftUp</span>: wipe up. |
|- | |- | ||
− | | [10] eShiftDown: wipe down. | + | | [10] <span class="inlinecode">eShiftDown</span>: wipe down. |
|} | |} | ||
<hr> | <hr> |
Revision as of 14:41, 23 August 2022
Name | Type | By |
---|---|---|
changeScene("scn", typ, duration) | Definition | AFRLme |
This small function allows you to change to another scene, define the scene transition effect & transition time.
Transition Values |
---|
[0] eFadeNo: no transition (immediate). |
[1] eFadeIn: fade in. |
[2] eFadeOut: fade out. |
[3] eFadeInAndOut: fade in & out. |
[4] eFadeToNew: fade to new scene (blending). |
[5] eShiftLeft: wipe left. |
[6] eShiftRight: wipe right. |
[7] eTunnelEffect</span>: tunnel fade in & out (circle). |
[8] eFadeShader: requires a shader to be linked via shaderSetOptions(). |
[9] eShiftUp: wipe up. |
[10] eShiftDown: wipe down. |
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(scn, typ, duration, fe, fd)
fe = game.FadeEffect -- store fade effect
fd = game.FadeDelay -- store fade delay
-- + --
if typ < 0 then typ = 0 elseif typ > 10 then typ = 10 end -- fallback in case fade effect is less than 0 or more than 10
game.FadeEffect = typ -- update fade effect to specified fade effect
game.GameFadeDelay = duration -- update fade duration to specified fade duration
-- + --
game.CurrentScene = Scenes[scn]
-- + --
setDelay(duration, function() -- restore previous scene effects
game.FadeEffect = fe -- restore fade effect back to stored fade effect
game.FadeDelay = fd -- restore fade duration back to stored fade duration
end)
end
Syntax Breakdown
Name | Type | Description |
---|---|---|
"scn" | "string" | This should be a "string" value containing the name of the scene you want to change to. |
typ | integer | This should be an integer value between 0 & 10, which will determine the transition effect. |
duration | integer | This should be an integer value containing the transition time between scenes in milliseconds. |