Difference between revisions of "SceneManager"

From GiderosMobile
m
Line 40: Line 40:
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Events</translate> ===
 
=== <translate>Events</translate> ===
[[Special:MyLanguage/SceneManager_enterBegin|enterBegin]]<br/><!-- GIDEROSEVT:enterBegin-->
+
[[Special:MyLanguage/SceneManager_enterBegin|"enterBegin"]]<br/><!-- GIDEROSEVT:enterBegin-->
[[Special:MyLanguage/SceneManager_enterEnd|enterEnd]]<br/><!-- GIDEROSEVT:enterEnd-->
+
[[Special:MyLanguage/SceneManager_enterEnd|"enterEnd"]]<br/><!-- GIDEROSEVT:enterEnd-->
[[Special:MyLanguage/SceneManager_exitBegin|exitBegin]]<br/><!-- GIDEROSEVT:exitBegin-->
+
[[Special:MyLanguage/SceneManager_exitBegin|"exitBegin"]]<br/><!-- GIDEROSEVT:exitBegin-->
[[Special:MyLanguage/SceneManager_exitEnd|exitEnd]]<br/><!-- GIDEROSEVT:exitEnd-->
+
[[Special:MyLanguage/SceneManager_exitEnd|"exitEnd"]]<br/><!-- GIDEROSEVT:exitEnd-->
 
=== <translate>Constants</translate> ===
 
=== <translate>Constants</translate> ===
 
SceneManager.moveFromRight<br/><!-- GIDEROSCST:SceneManager.moveFromRight-->
 
SceneManager.moveFromRight<br/><!-- GIDEROSCST:SceneManager.moveFromRight-->

Revision as of 21:39, 27 March 2020

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