How do I restart game layer with the same global variables

  • Hi everyone!

    So i'll try to describe what problem i have

    I have a "start layout" with three levels of difficulty. Easy, medium, insane (for example), that's three levels are sprite buttons. When you press one of the button it takes you to "game layer" and change global variables for example (time of object's spawn and coin multiplier). default values are 0 in that global variables. So the problem is how to save the same global variables when you press "restart" layer button (for example time of object's spawn = 1.5 sec and coin multiplier x1) because when i hit restart button layer resets ang globals become to 0.

  • One possible solution is to store the difficulty setting in a Global, then 'initialize' your Layout variables based on the difficulty setting global.

    That way, when you restart (make sure not to reset globals), the difficulty setting is still set, and the relevant variables will be correctly initialized.

  • is there any capx for realizing how to do this? Or some lesson?

  • ,,,,,,,,,,,,,,,,,,,

  • TY korbaach

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • so another question is that possible to split hightscores stored in webstorage on one layer with different difficulty? For example if i scored 10 on easy level save that easy scores to "easy" webstorage and show when character died in the end?

  • you can use Var_easy_HS for "easy" webstorage..Var_normal_HS for "normal" webstorage.......

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)