I'm trying to learn how to use the SceneManager, so I made this:
main.lua:
sceneManager = SceneManager.new({
["menu"] = Menu,
})
stage:addChild(sceneManager)
sceneManager:changeScene("menu") |
menu.lua:
Menu = Core.class(Sprite)
function Menu:init()
local botao = Bitmap.new(Texture.new("button.jpg"))
stage:addChild(botao)
end |
The button itself doesn't matter. I just putted something on the screen to try the scene management.
The real problem is this:
Uploading finished.
main.lua:1: attempt to index nil with 'new'
stack traceback:
main.lua:1: in function |
Am I doing this right? The tutorial i'm following is 5 years old, so if i'm doing something wrong please tell me!
Thanks in advance!!!
Comments
Let me share how I do it
init.lua:
https://wiki.gideros.rocks/index.php/SceneManager
Likes: Gabriel_Mercês
You're making it true for me that Gideros Mobile community is the best!
Likes: MoKaLux
https://github.com/mokalux/GIDEROS_PLATFORMER_CBUMP_GCAM_TECS
Likes: Gabriel_Mercês
- add scenemanager to gideros plugins (right click Plugins) -> add plugin
- require "scenemanager"
Likes: Gabriel_Mercês
Likes: MoKaLux
PS: don't add your button to the stage but add it to your scene (here the menu scene represented by self)
Likes: Gabriel_Mercês
This example is more complete https://github.com/mokalux/PLATFORMER_CBUMP_TECS_20221101_wodt