I am new to construct and i could not find how to restart the game/layer. Please help.
Use goto layout and got the name of the current layout.
So if you layout is named "Layout 1", use this action:
-> System: Go to layout "Layout 1" with transition "None" lasting 0 MS
I did this, but when I go to the same layout (or any other layout) I have a crash. The game freeze. Maybe because I'm using phyhics and there is a bug with that?
Develop games in your browser. Powerful, performant & highly capable.
It works for me when using the physics behavior. What other objects/Behaviors are you using? Also if you post a cap that will make it easier to figure out the reason for the crash.
The workaround I would use is this:
Make a global text variable, named like LayoutToGoTo for example.
Make a new layout, named LayoutRestarter for example. In this layout, have just one event, something like:
Start of layout: Go to layout global('LayoutToGoTo')
So, to restart your current layout, you could set the global variable's value to the current layout's name, then go to the layout LayoutRestarter.
To get the current layout's name, it is.. somewhere in the system object. CurrentLayout ? LayoutName ? I forget.
I don't know why. Now with this version 85 (instead of 84) I re do the project and
now the game works! Seem that I can switch between the layers without difficult!