Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
SceneManager — Gideros Forum

SceneManager

SinisterSoftSinisterSoft Maintainer
edited October 2014 in Bugs and issues
SceneManager can fail if it hasn't completed the current scene when you select a new scene - but there is no failure code.

Here is a mod to provide a failure true/false:
function SceneManager:changeScene(scene, duration, transition, ease, options)
	self.eventFilter = options and options.eventFilter
 
	if self.tweening then
		return false
	end
 
	if self.scene1 == nil then
		self.scene1 = self.scenes[scene].new(options and options.userData)
		self:addChild(self.scene1)
		dispatchEvent(self, "transitionBegin")
		dispatchEvent(self.scene1, "enterBegin")
		dispatchEvent(self, "transitionEnd")
		dispatchEvent(self.scene1, "enterEnd")
		return true
	end
 
	self.duration = duration
	self.transition = transition
	self.ease = ease or defaultEase
 
	self.scene2 = self.scenes[scene].new(options and options.userData)
	self.scene2:setVisible(false)
	self:addChild(self.scene2)
 
	self.time = 0
	self.currentTimer = os.timer()
	self.tweening = true
	return true
end
Use like:
if sceneManager:changeScene("play",1) then
.
-- it worked
.
else
.
-- it failed
.
end
 
or
 
	self.countdown=self.countdown-1
	if self.countdown==0 then
		if sceneManager:changeScene("bet",1)==false then
			self.countdown=1
		end
	end
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
https://deluxepixel.com
+1 -1 (+2 / -0 )Share on Facebook

Comments

Sign In or Register to comment.