It looks like you're new here. If you want to get involved, click one of these buttons!
--set up the application variablesStart.lua:
application:setLogicalDimensions(1200, 1920)
application:setOrientation(Application.LANDSCAPE_LEFT)
application:setScaleMode("letterbox")
application:setBackgroundColor(0x140C1C)
--define the scenes
sceneManager = SceneManager.new({
["start"] = Start, --start scene
["character"] = Character, --character creation scene
["play"] = Game, --the main game
})
--add manager to stage
stage:addChild(sceneManager)
sceneManager:changeScene("start", 1, SceneManager.flipWithFade)
CharCreation.lua:
Start = gideros.class(Sprite)
function Start:init()
local words = TextField.new(TTFont.new("fonts/Bembo-Std.ttf", 60, true), "Touch the screen to begin")
words:setTextColor(0xF9FAFA)
words:setPosition(20, 200)
words:setAlpha(1)
self:addChild(words)
--set up the onEnterFrame and onMouseUp EventListeners
self:addEventListener(Event.MOUSE_UP, self.onMouseUp, self)
self:addEventListener("exitBegin", self.onExitBegin, self)
end
--removing event on exiting scene
function Start:onExitBegin()
self:removeEventListener(Event.MOUSE_UP, self.onMouseUp, self)
end
function Start:onMouseUp()
sceneManager:changeScene("character", 1, SceneManager.flipWithFade)
end
Character = gideros.class(Sprite)GamePlay.lua:
function Character:init()
print("character created")
sceneManager:changeScene("play", 1, SceneManager.flipWithFade)
end
Game = gideros.class(Sprite)
function Game:init()
self:addChild(Bitmap.new(Texture.new("images/foreground.png", true)))
print("playing")
end
Comments
http://giderosmobile.com/forum/discussion/480/gideros-game-template/p1
Thanks for the quick response!
Adding easing.lua and calling sceneManager with a easing variable doesn't solve the problem.
Also, I'm not sure how my GamePlay.lua file is wrong. @ar2sawseen has level.lua which is equivalent to my GamePlay.lua and it is simply: None of his other scenes have the last onExitBegin() function. But even adding it to GamePlay.lua doesn't help.
So we still have a problem!?
when it will create character for real it would likely take some time (or a confirmation tap by the user) that should fix it without timer tricks..
Likes: tytadas
You will see that I have included in all scenes the functions that handle events such as "enterBegin", "enterEnd", "exitBegin", and "exitEnd". Even if you do not use some of these it is good to always include them so you know you have complete control.
Some of your classes were starting things (like touch listeners) before the scene had actually transitioned in. This is to be avoided as switching scenes too quickly can confuse sceneManager, as is demonstrated by the character scene failing to transition to the game scene.
In your character scene I just replicated some code from the start scene so it now sits there once the scene has transitioned in and waits for another touch event before proceeding to the game scene.
In all scenes I also added "enterFrame" code
Likes: tytadas