I searched hours long and still didn't understand.
Here is my problem, I made a tiny game it's working, but now I need a menu, highscores screen and so on. It's meaning that my game is completly made without using storyboards/scenes functions.
This is my structure:
Introduction
In there I put everything that needs to be started at first such as the physics function.
Variables
In there I have all my variables such as:
local object = 0 <or>
local object = display.newObject(param)
Functions
I put in there all my functions such as:
local function functionName (event)
end
Event listeners
In there I have every event listener such as:
functionName:addEventListener("eventType", functionName)
So this is all what I have, what I found in my researches is that I need some functions to create my scene, enter my scene, exit my scene and destroy my scene. The problem is I don't know where to put these scenes and where to put the rest of my code. Basically what I need is:
- A menu with a play button and a highscore button.
- when tapping on my play button, it's jumping to my game scene (it's always the same game, it doesn't contain any level or so), if loosing then jumping to another scene that looks like, restart or go to menu.
- when tapping on the highscore button it'll show the best scores.
And what if create objects in my functions? Is it going to disturb the scene? And what about score, I need it when switching scenes for the highscore and so on, is there a way to don't make the score not only local but public?
I hope I'm clear enough and that you will understand what I need! :) As structure example, there is the game called "doodle jump", and my game structure should look a bit the same.