How do I maintain the score from one layout to the next?

0 favourites
  • 8 posts
From the Asset Store
Create the right kind of drama with Film Scoring Tools sound library!
  • Hello again.

    Here I come with another silly question...

    I've got a sprite for the player who every time is on collision with an object it adds 1 to the variable for the score, but when it goes to the next layout it always resets to 0... What am I doing wrong?

    Thanks for your help!

  • It's an instance variable on the object? You can either make the object global so it continues to the next layout with the same stats, or the norm is to use a global variable for things like Score.

  • Yes, it's a global variable and both layouts are using the same eventsheet, so I think there's something going on that I don't get. Any ideas of what can it be?

  • You must have an event to set it to 0 on start of layout, or to reset global variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Fixed, Thanks!

    I figured out what was the problem... The variable wasn't resetting at all, I just forgot to set the text to the variable on start of layout, so it always said 0

  • I have another question, if it's not a problem ... When my character dies the score stays the same when the level starts again, and I would like it to be restored to the amount it had when the level started. Any idea on how to do that?

  • You would store that as another variable. Var A that is set at the start of the level and Var B in the level that increases during gameplay. When you die you set Var B to Var A value.

  • Thanks! Done!

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