I want to reset my layout but without resetting the Global Variable.

0 favourites
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • To plinkie:

    The object is showing 3 because the initial value of the Global Variable is 3. Updating the value in the text object? How? In the Global Variable and Local Variable, there is no option to update the value, except for "set value". But this option will fix the value at a permanent number that will not vary.

  • The variable seems to be reducing as expected, just the text object displaying it is not updating. If you move it to every tick you can see it's fine, so you need to move the 'set text' to a better place. You have other bugs though, at the end of a level it subtracts 2 chances instead of 1. A few things to fix.

  • To plinkie:

    I know, I have a lot of things to fix. This is a game who is similar to Tic-Tac-Toe but I think that the codes with the triangles and squares don't work. I will have to apply for another method.

  • To plinkie:

    I have solved some problems in my game by changing the order of the codes. But the Global variable returning to 3 each time that I click "Restart", remains an issue. I wonder what would be the solution because I have tried your suggestion with the "Every tick" condition and it's still not working.

  • Variable looks alright if you check it in debug mode, the issue is setting the text, you can use set text all the time so it's always showing the correct variable rather than in a trigger once. If that doesn't work you'll have to share the new file.

  • Hello, your variable is working just fine, as plinkie said it doesn't reset, which is also a problem when you game over or quit the game since the variable doesn't reset to 3, causing instant game over or new game with less than 3 lives;

    Here is a fix to your text displaying problem :

    Also you need to reset manually the Numberchances variable each time you quit the current game or game over, for that you need an event associated to the buttons :

    Also do you use the full version or demo version of C2?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To Tomycase and plinkie:

    Thanks for your help, I have finally solved the issue by following your instructions. I will be able to move further in my project

    thank you again!

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