Difference between revisions of "SceneManager"
From GiderosMobile
(Created page with "__NOTOC__ <!-- GIDEROSOBJ:SceneManager --> '''<translate>Supported platforms</translate>:''' File:Platform android.pngFile:Platform ios.pngFile:Platform pc.pngFi...") |
m (added one more example) |
||
Line 38: | Line 38: | ||
SceneManager.flipWithShade, -- 21 | SceneManager.flipWithShade, -- 21 | ||
} | } | ||
+ | </source> | ||
+ | |||
+ | How to declare and change scenes | ||
+ | <source lang="lua"> | ||
+ | require "scenemanager" | ||
+ | require "easing" | ||
+ | |||
+ | scenemanager = SceneManager.new( | ||
+ | { | ||
+ | ["menu"] = Menu, | ||
+ | ["level1"] = Level1, | ||
+ | } | ||
+ | ) | ||
+ | |||
+ | stage:addChild(scenemanager) | ||
+ | scenemanager:changeScene("menu") | ||
+ | --scenemanager:changeScene("level1", 1, SceneManager.moveFromRight, easing.outBack) | ||
</source> | </source> | ||
Revision as of 17:36, 9 March 2020
Supported platforms:
Available since: 2020.2
Description
An easy way to manage scenes.
require "scenemanager"
Example
A table holding all scene transitions
require "scenemanager"
-- TRANSITIONS
transitions = {
SceneManager.moveFromRight, -- 1
SceneManager.moveFromLeft, -- 2
SceneManager.moveFromBottom, -- 3
SceneManager.moveFromTop, -- 4
SceneManager.moveFromRightWithFade, -- 5
SceneManager.moveFromLeftWithFade, -- 6
SceneManager.moveFromBottomWithFade, -- 7
SceneManager.moveFromTopWithFade, -- 8
SceneManager.overFromRight, -- 9
SceneManager.overFromLeft, -- 10
SceneManager.overFromBottom, -- 11
SceneManager.overFromTop, -- 12
SceneManager.overFromRightWithFade, -- 13
SceneManager.overFromLeftWithFade, -- 14
SceneManager.overFromBottomWithFade, -- 15
SceneManager.overFromTopWithFade, -- 16
SceneManager.fade, -- 17
SceneManager.crossFade, -- 18
SceneManager.flip, -- 19
SceneManager.flipWithFade, -- 20
SceneManager.flipWithShade, -- 21
}
How to declare and change scenes
require "scenemanager"
require "easing"
scenemanager = SceneManager.new(
{
["menu"] = Menu,
["level1"] = Level1,
}
)
stage:addChild(scenemanager)
scenemanager:changeScene("menu")
--scenemanager:changeScene("level1", 1, SceneManager.moveFromRight, easing.outBack)
Methods |
EventsConstants |