SceneManager

From GiderosMobile
Revision as of 21:39, 27 March 2020 by MoKaLux (talk | contribs)

Supported platforms: Platform android.pngPlatform ios.pngPlatform pc.pngPlatform mac.pngPlatform winrt.pngPlatform win32.png
Available since: 2020.2
Inherits from: Sprite

Description

An easy way to manage scenes.
Note: works in pair with the Easing plugin

require "scenemanager"

Example

How to declare and change scenes

require "scenemanager"
require "easing"

scenemanager = SceneManager.new(
	{
		["menu"] = Menu,
		["level1"] = Level1,
	}
)
stage:addChild(scenemanager)
-- from app start to menu
scenemanager:changeScene("menu")
-- from menu to level1
--scenemanager:changeScene("level1", 1, SceneManager.moveFromRight, easing.outBack)

Methods

SceneManager.new creates a new SceneManager object

SceneManager:changeScene transitions to a scene

Events

"enterBegin"
"enterEnd"
"exitBegin"
"exitEnd"

Constants

SceneManager.moveFromRight
SceneManager.moveFromLeft
SceneManager.moveFromBottom
SceneManager.moveFromTop
SceneManager.moveFromRightWithFade
SceneManager.moveFromLeftWithFade
SceneManager.moveFromBottomWithFade
SceneManager.moveFromTopWithFade
SceneManager.overFromRight
SceneManager.overFromLeft
SceneManager.overFromBottom
SceneManager.overFromTop
SceneManager.overFromRightWithFade
SceneManager.overFromLeftWithFade
SceneManager.overFromBottomWithFade
SceneManager.overFromTopWithFade
SceneManager.fade
SceneManager.crossFade
SceneManager.flip
SceneManager.flipWithFade
SceneManager.flipWithShade