Thanks Rob I created the proper files and added items to the group. I now get this error on the main.lua sheet
Attempt to index global ‘compser’ (a nil value)
Thanks Rob I created the proper files and added items to the group. I now get this error on the main.lua sheet
Attempt to index global ‘compser’ (a nil value)
If the error you pasted is not a typo, then “comp o ser” is misspelled.
Im such a noob didnt even catch that thanks
No worries. Happens to everyone!
So I got everything working I have the main.lua going to mainScreen.lua but now when I push the button to go to the next scene it gives me this message:
File: ?
Attempt to concatenate global ‘sceneName’ (a nil value)
stack traceback:
?: in function ‘gotoScene’
mainScreen.lua:27: in function ‘_onRelease’
?: in function ‘?’
?: in function <?:677>
?: in function <?:221>
I have the next scene within the project and I the thing I can think of is the function listed above. Any Ideas
Does your levelSelect.lua scene exist? Is it doing a “return scene” as it’s last line?
Rob
Hey Rob Yes the file exist and i realize early it didnt have the return scene and added it and it worked thanks
Hi guys,
I need some help, @birdiesawyer I am having issues with gotoScene right when hitting the button and releasing it.
stack traceback:
?: in function ‘gotoScene’
mainScreen.lua:23: in function ‘_onRelease’
?: in function ‘?’
?: in function <?:677>
?: in function <?:221>
Mine is doing the same thing yours was with return
– ‘onRelease’ event listener for playBtn
local function onPlayBtnRelease()
– go to level1.lua scene
composer.gotoScene(“Game”)
return true – indicates successful touch
end
can someone elaborate what I have to add as a “return scene” to make it work?
My game scene right now does not have the composer functions (editing it to make it compatible like my menu screen which pretty much like yours listed above)
It does switch to the game.lua and game starts but my “ship” does not move when you try to move it with a finger on it, if its not passed through the composer it works fine.
I am also new btw
If you’re going to use Composer, you have to **use** Composer. Take a moment and study the standard template as seen here: https://docs.coronalabs.com/guide/system/composer/index.html#scene-template
Every line of code in the template, must be in your scene file and they need to be in the order they are here. That is you have to require composer at the top and create the new scene. It has to end with the statement “return scene”. The four event functions and their addEventListener statements have to be there. Your job is to fill in the scene:create(), scene:show() functions with the appropriate code there and well as other functions and code.
When you do that you will have a complete scene file that can be called. Always start with the template file and add your code to it. I do!
Rob
Rob
Thank you Rob, this is very helpful.
Hi guys,
I need some help, @birdiesawyer I am having issues with gotoScene right when hitting the button and releasing it.
stack traceback:
?: in function ‘gotoScene’
mainScreen.lua:23: in function ‘_onRelease’
?: in function ‘?’
?: in function <?:677>
?: in function <?:221>
Mine is doing the same thing yours was with return
– ‘onRelease’ event listener for playBtn
local function onPlayBtnRelease()
– go to level1.lua scene
composer.gotoScene(“Game”)
return true – indicates successful touch
end
can someone elaborate what I have to add as a “return scene” to make it work?
My game scene right now does not have the composer functions (editing it to make it compatible like my menu screen which pretty much like yours listed above)
It does switch to the game.lua and game starts but my “ship” does not move when you try to move it with a finger on it, if its not passed through the composer it works fine.
I am also new btw
If you’re going to use Composer, you have to **use** Composer. Take a moment and study the standard template as seen here: https://docs.coronalabs.com/guide/system/composer/index.html#scene-template
Every line of code in the template, must be in your scene file and they need to be in the order they are here. That is you have to require composer at the top and create the new scene. It has to end with the statement “return scene”. The four event functions and their addEventListener statements have to be there. Your job is to fill in the scene:create(), scene:show() functions with the appropriate code there and well as other functions and code.
When you do that you will have a complete scene file that can be called. Always start with the template file and add your code to it. I do!
Rob
Rob
Thank you Rob, this is very helpful.