hi in my game i added an intro i would like to play this juste ONCE, so i added an "intro" global variable if the variable is "0" then the intro is played and then set to "1", if the "intro" global variable is = "1" then the players goes directly to the first level.
so at te beginin of the game, at the menu i compare that value if is = to "0" or "1".
but this is not working, im stuck with this problem :s
Well the variable will always be 0 on load, unless you're using localstorage to save and load it. If you're talking about within the same game, then returning to the main menu and comparing the variable should work and so there must be some broken logic somewhere.
how can i achive that easily?
It looks like you know what you're doing so I can't determine where the problem is, unless you're talking about localstorage and saving this variable when you close the game?
yeah that part, with the local storage just for playing the intro once.
Check out the localstorage tutorials. You save the variable to localstorage at the start of the intro or whenever it changes. When you load the game, you load that key from localstorage and it remembers it as 1, rather than the initial 0.
https://www.scirra.com/tutorials/1461/h ... age-plugin
Develop games in your browser. Powerful, performant & highly capable.
i tried, but i cant end whit that problem...........
i spent so many hours....
in my game i have 3 layouts who share the same event sheet, the MENU, the INTRO and LEVEL 1
In the capx i have the game pad, one sprite for the start buton and one sprite for the continue buton
if the variable "intro" = "0" then we load the layout "intro", IF the variable intro = "1" then we load the layout "level1"
thats all i need to achive, tried lot of things... nothing works...
Post a screenshot of the logic for the if variable / go to layout events.
i removed everything.......
Imo, why you are doing it thru the GLobals? Make a Layout and named it as "Intro". NOT LAYER!!! Layouts work separately and makes the performance of the games much more smoother. After your "Intro" you can simply write "Go to layout -> Game" And thats all. Cheers buddy!
my layout is named INTRO i just need to play that layer ONCE that layer share the same event that the full game, LEVELS