How do I remember the highscore in the other layout?

0 favourites
  • 3 posts
From the Asset Store
Try to remember the sequence of moving pumpkins. Reproduce it according to your memory.
  • 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.

  • Try Construct 3

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

    Try 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)