Hello all i´m having trouble with sceneManager here is my code:
main.lua:
sceneManager = SceneManager.new({
["start"] = start,
["level"] = level,
["credits"] = credits,
})
stage:addChild(sceneManager)
sceneManager:changeScene("start",1,SceneManager.moveFromRight)
---------------------------------------------------------------------------------------------------
start.lua:
start = gideros.class(Sprite)
function start:init()
local mainscreen = Bitmap.new(Texture.new("images/start_screen.png"))
stage:addChild(mainscreen)
local startbt = Bitmap.new(Texture.new("images/start_bt.png"))
local buttonS = Button.new(startbt,startbt)
startbt:setPosition(50,220)
stage:addChild(startbt)
buttonS:addEventListener("click",
function()
sceneManager:changeScene("level",1,SceneManager.moveFromRight)
end
)
local creditbt =Bitmap.new(Texture.new("images/credits_bt.png"))
local buttonC = Button.new(creditbt,creditbt)
stage:addChild(buttonC)
creditbt:setPosition(200,220)
buttonC:addEventListener("click",
function()
sceneManager:changeScene("credits",1,SceneManager.moveFromRight)
end
)
end
----------------------------------------------------------------------------------
The problem is only one button is working the buttonC, the ButtonS is not working i click and nothings happens
thanks in advance.
Comments
Try that, changing stage:addChild(startbt) to stage:addChild(buttonS)
I hope run you!
Likes: rcorreiaptpt
But even more, you should add everything to the scene, like: