I am currently trying to change scenes with scenemanager. The probem is, when i use
sceneManager:changeScene("game", 1, SceneManager.moveFromRight, easing.outBack)
(trying to change to the "game" scene)
Also in the starting scene is the starting code and this:
function StartScene:onExitBegin()
self:removeEventListener(Event.ENTER_FRAME, self.onEnterFrame, self)
end
Basically, I want a clean slate for my actual game's code.
The elements currently on the screen are still there (and the buttons are still interactive.)
This seems rather inefficient as well as potentially problematic (imagine playing a game with a menu still loaded in the background)
What am i doing incorrectly?
also i can post the full code if necessary, but i would rather not (it could confuse people due to it having 8 .lua files, some of which do not pertain to the question.) But if you need me to post it ask me i will happily do so.
Thanks!
“ The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. ” - Tom Cargill
Comments
But let me say some things that can be the reason:
1-If you are using the same code in scenemanager github page, be sure that your scene names are corect in the array and in the definition part.
https://github.com/gideros/Scene-Manager
Always do:
How would i self:addchild for the buttons however? They are managed in a seperate button.lua and not in my scene - the button code:
function Button:init(theSpriteName, xPos, yPos, parent)
local parent = parent or stage
local bitmap = Bitmap.new(Texture.new(theSpriteName, true))
local xPos, yPos = xPos or 0, yPos or 0
self:addChild(sprite)
self:addEventListener(... the rest of the code ...)
self:setPosition(xPos, yPos)
parent:addChild(self)
end
you simply create an instance and add it to the scene:
Yes your fix should work