Do i need to create scenes for each & every level because i didn’t felt comfortable with lua “local” thing.
No, it’s not. You can make your whole game work in a single game level file. You should look for Composer variables.
You probably should get comfortable with “local”. If you’re not using “local”, then you’re using globals and globals if you don’t know what you’re doing will lead to problems that you may not be able to program around later, problems that are very difficult to solve and performance problems.
But to answer the question you can either have difference scenes for each level or you can have a single game level that uses data to play each level differently. A lot depends on the game and how it needs played.
Rob
Thanx everyone for the suggestions, @Rob Miracle the only thing that i find uncomfortable is that while creating a scene, each scene has different functions such as create show etc----, but in a given game we have a lot variables that need to be acccessed from each function, but however when i declare some local variables in a create function & i want to access it in other function say show , it becomes a overhead to always declare require(“mydata”) to access local variables in each & every module, is there any other way to deal with it ?
You can declare variables at the top, before the functions and then use them in your scene. Also, you can use Composer library to store and access your variables from different scenes.
Thanx for your suggestion bgmadclown i’ll try that
No, it’s not. You can make your whole game work in a single game level file. You should look for Composer variables.
You probably should get comfortable with “local”. If you’re not using “local”, then you’re using globals and globals if you don’t know what you’re doing will lead to problems that you may not be able to program around later, problems that are very difficult to solve and performance problems.
But to answer the question you can either have difference scenes for each level or you can have a single game level that uses data to play each level differently. A lot depends on the game and how it needs played.
Rob
Thanx everyone for the suggestions, @Rob Miracle the only thing that i find uncomfortable is that while creating a scene, each scene has different functions such as create show etc----, but in a given game we have a lot variables that need to be acccessed from each function, but however when i declare some local variables in a create function & i want to access it in other function say show , it becomes a overhead to always declare require(“mydata”) to access local variables in each & every module, is there any other way to deal with it ?
You can declare variables at the top, before the functions and then use them in your scene. Also, you can use Composer library to store and access your variables from different scenes.
Thanx for your suggestion bgmadclown i’ll try that