How to fix this old high score demo?

0 favourites
  • 4 posts
From the Asset Store
Demo Game Multiplayer Online with member registration system
  • C3

    I found a C2 demo in an old post a while back. The demo records the score and the highest score - saves it to an array/local storage blah, blah, blah.

    I've dissected it for a few days and it works great for levels 0 - 3, but stops recording the score/high score on level 4. Also any new levels I make have the same problem as level 4.

    I've tried changing the level global variable, changing the instance variable and several other things, but nothing seems to solve the problem.

    I'm thinking it may have something to do with the size of the array, but I'm only assuming that because I'm not great with arrays. The only other thing I can come up with is that something isn't syncing because I'm opening it in C3, but that's never happened to me before.

    What am I missing?

    Thank you.

  • Yes the size of the array is number of levels. You have 5 levels but levels variable is set to 4. Problem is also you have to clear local storage because it will keep loading the old array of 4 when you've saved already. Changing levels variable won't fix it unless local storage is cleared first.

  • ,

    I was afraid it was something with arrays. Guess I shouldn't have picked this demo to try to learn arrays. I've done them in Lua & JS, but can't seem to wrap my head around them in C3.

    Back to the drawing board. Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another way to do it is just use system "save" and it will save the game at the current state, so you could save every time you hit the main menu and it would also load from there.

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