on restart level - restart 1 glob.variable

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hello,

    I will explain my situation on the following example:

    When I click on for example "Level 2" button I want to set my textObject to 300 and when I click on "Level 15" button the textObject has to be set to 150 for example. Its quite easy, no problem - BUT what if I create the RESTART button?

    When I click it I want those textsObjects to be set to its default values.

    So when clicked on restart in the level 2 text has to be 300 again (because during the level it will be falling to 0)

    How to do this? How to restart a specific global variable in a specific level?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • on restart button click -> write current value in anouther Global Variable

    on layout 1 start -> read from the global variable and set the textobjects to this..

    idk what you mean maybe explain a bit more :O

  • I think the easiest way to realize that is to make a function with one param. The Param should be your level.

    --> pick textbox // at first pick the textObject

    ---> param0 equals 2 -> set textbox-text to 300

    ---> param0 equals 15 -> set textbox-text to 150

  • I think you can make it using the "on start of layout" and setting the value to the corrrent value for that layout.

    If you reset the game on that layout the value will reset to the value specified in the "on start of layout".

    GL

  • got it, thanks guys...

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