How do I restart the layout without reseting the variables?

0 favourites
  • 2 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I'm trying to restart the layout when the variable Life = 0, but when i do this my other variables like Coins reset too (The Life variable is global and the Coins variable is instance variable) what do i do?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instance variables belong to object instances. When you restart the layout, object instances are destroyed and created again. That's why the variables reset.

    You can use global variables to store values which should not reset. Or data objects - arrays, dictionaries, JSON.

    Another option is to set your object as Global. It will not be destroyed as you restart or go to another layout. But be very careful, make sure that you are not creating multiple duplicates of this global object with every restart. Use Debug Mode to check.

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