0 Favourites

How do I remember the highscore in the other layout?

  • Hi everyone!

    Again a very easy beginner's question!

    I have 2 layouts, one with a start button. The game is about surviving as long as possible. So every second 1 is added the score. When the player collides with an object, the layout changes, because you have to start again from the beginning. Problem is: You should see the score you reached on this "start" layout. But it is only visibile in the layout where the current game runs.

    It is frustrating, because I was able to do it some time ago and I forgot how it worked...

    Thanks already for your answers!

    Julia

  • Well if you keep the score in a global variable, you can add a text into the new layout and set the text to the global variable in the event system, nametext -> set text -> global variable. You will need to make sure to save the text first then reset the variable to 0 so player can start again, and if you like to keep the text forever even if the players closes the game you will have to save it into local storage or in an array as Json.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hi,

    You just need to use GLOBAL variables, which are visible across your entire project.

    You can create one SCORE

    and another BEST_SCORE

    And then you can add a TEXT #1 and say something like SYSTEM every tick, SET TEXT to SCORE.

    And then TEXT #2 set text to BEST_SCORE

    And then if SCORE > BEST_SCORE set BEST_SCORE = SCORE

    There are also lots of guides/tutorials on LOCAL / WEB storage if you want the player's computer to remember the BEST_SCORE

    Good luck!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,132
karshinkoff's avatar
karshinkoff
Unread hot topic
132 29,584
chadorireborn's avatar
chadorireborn
Unread hot topic
52 8,561
BluePhaze's avatar
BluePhaze