Difference between revisions of "ChangeScene (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m |
|||
(5 intermediate revisions by the same user not shown) | |||
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] <span class="inlinecode">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> | ||
Line 50: | Line 50: | ||
fd = game.FadeDelay -- store fade delay | fd = game.FadeDelay -- store fade delay | ||
-- + -- | -- + -- | ||
− | |||
game.FadeEffect = typ -- update fade effect to specified fade effect | game.FadeEffect = typ -- update fade effect to specified fade effect | ||
game.GameFadeDelay = duration -- update fade duration to specified fade duration | game.GameFadeDelay = duration -- update fade duration to specified fade duration | ||
-- + -- | -- + -- | ||
− | game.CurrentScene = Scenes[scn] | + | game.CurrentScene = Scenes[scn] -- update scene |
-- + -- | -- + -- | ||
− | setDelay(duration, function() -- restore previous scene effects | + | setDelay(duration, function() -- delayed function which will be used to restore previous scene effects |
game.FadeEffect = fe -- restore fade effect back to stored fade effect | game.FadeEffect = fe -- restore fade effect back to stored fade effect | ||
game.FadeDelay = fd -- restore fade duration back to stored fade duration | game.FadeDelay = fd -- restore fade duration back to stored fade duration | ||
Line 71: | Line 70: | ||
| "scn" || "string" || This should be a "string" value containing the name of the scene you want to change to. | | "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 | + | | typ || integer || This should be an integer value between 0 & 10 or the variable name equivalent which will be used to determine the transition effect. |
|- | |- | ||
| duration || integer || This should be an integer value containing the transition time between scenes in milliseconds. | | duration || integer || This should be an integer value containing the transition time between scenes in milliseconds. | ||
|}{{toc}} | |}{{toc}} |
Latest revision as of 14:45, 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: 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
-- + --
game.FadeEffect = typ -- update fade effect to specified fade effect
game.GameFadeDelay = duration -- update fade duration to specified fade duration
-- + --
game.CurrentScene = Scenes[scn] -- update scene
-- + --
setDelay(duration, function() -- delayed function which will be used to 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 or the variable name equivalent which will be used to determine the transition effect. |
duration | integer | This should be an integer value containing the transition time between scenes in milliseconds. |