Scene Managment Help
Posted: Fri Jan 03, 2025 10:45 pm
EDIT: I fixed it! I had to use love.graphics.reset() in my game.load() function to get rid of the previous scene's graphics
Hello! this is my first post on these forums,
My issue is I have made a game and a menu, and I'm trying to use StackingSceneMgr (SSM https://gitlab.com/V3X3D/love-libs/-/tr ... type=heads) to start in the Menu and then switch to the Game when I hit the start button.
Both my scenes work when I set them to be the first scene, but I cannot figure out how to switch scenes from one to the other.
Here's the code on my main.lua:
and the code in my start button in the menu.lua:
The menu and buttons load correctly, but when I click the button "start game" the menu disappears and I only have a black screen.
my game loads correctly if I add the game scene first, so I'm not sure what's going wrong.
Any help is greatly appreciated! Let me know if posting more of my code would help trouble shooting
Hello! this is my first post on these forums,
My issue is I have made a game and a menu, and I'm trying to use StackingSceneMgr (SSM https://gitlab.com/V3X3D/love-libs/-/tr ... type=heads) to start in the Menu and then switch to the Game when I hit the start button.
Both my scenes work when I set them to be the first scene, but I cannot figure out how to switch scenes from one to the other.
Here's the code on my main.lua:
Code: Select all
SSM = require "lib.StackingSceneMgr".newManager()
SSM.setPath("scenes/")
function love.load()
SSM.add("menu")
end
function love.update(dt)
SSM.update(dt)
end
function love.draw()
SSM.draw()
end
and the code in my start button in the menu.lua:
Code: Select all
"Start Game",
function ()
print("starting game!")
SSM.removeAll()
SSM.purge("menu")
SSM.add("game")
end))
my game loads correctly if I add the game scene first, so I'm not sure what's going wrong.
Any help is greatly appreciated! Let me know if posting more of my code would help trouble shooting