How do I Save a High Score after a Reset

Get help using Construct 2

Post » Wed Nov 09, 2016 6:35 am

Hi,

I have implemented a high score in my game using local storage.

When a game ends and I press "S" to start a new game a load save state is initiated. When this happens the On Item Exist condition is for some reason not being met causing the high score to not continue into the next game.

However, if I close the game and start fresh without a reset the On Item Exists condition IS MET and the high score is displayed...That is until I start a new game.

Anyone have advice I would appreciate it!

https://www.dropbox.com/s/b6jgqwbzol8ha ... .capx?dl=0

Thanks
Philip
B
6
Posts: 14
Reputation: 278

Post » Wed Nov 09, 2016 10:31 am

Instead of loading your savegame slot "reset" restart the layout. You save your "reset" slot after the checking the localstorage item then when you load it, the item is never check and the trigger (event 3) is inactive
Image Image
B
22
S
13
G
135
Posts: 871
Reputation: 70,320

Post » Wed Nov 09, 2016 1:11 pm

Hey Madspy!

Thanks for the reply.

Unfortunately, the load state is there in order to regenerate the shields at the start of a new game.

In Object Type Properties Shields had to be set to a Global YES. This way the shield damage continues into the next level.

Then on restart by hitting "S" it needs to load a save state to regenerate the shields.

Also, I tried putting a play sound in event 1 to ensure it was getting to the load Check Item "HighScore" exists. And it does play the sounds, so in theory it should seeing HighScore exists.

Philip
B
6
Posts: 14
Reputation: 278

Post » Wed Nov 09, 2016 1:54 pm

What I maybe need to do is figure out a way to leave my shields Object Type Properties Shields set to a Global YES but find a way to make them regenerate on a new game by another means than a load state.

Any ideas?

p
B
6
Posts: 14
Reputation: 278

Post » Wed Nov 09, 2016 8:42 pm

Maybe some sort of array would help?
B
6
Posts: 14
Reputation: 278

Post » Thu Nov 10, 2016 2:15 pm

Anyone have any ideas?

Thanks
B
6
Posts: 14
Reputation: 278

Post » Thu Nov 10, 2016 2:32 pm

Twincade wrote:Anyone have any ideas?

Thanks


Hi I made the official Highscore tutorial its located here

https://www.scirra.com/tutorials/5343/h ... -game-capx

The capx. file is also included let me know if you need any help.
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Thu Nov 10, 2016 2:54 pm

Hi PixelPower

I used your tutorial to set my high score up, thanks it's great

unfortunately, in my circumstance it doesnt work

Any ideas?
B
6
Posts: 14
Reputation: 278

Post » Thu Nov 10, 2016 3:08 pm

As you reset all global variable when you hit S to restart, the shield object don't have to be set as global so restart the layout instead of reloading your "reset" slot reload the shield and load the highscore
Image Image
B
22
S
13
G
135
Posts: 871
Reputation: 70,320

Post » Thu Nov 10, 2016 3:17 pm

The shields have to stay on global so that the damage is retained into round 2

If I set shields to a global NO the shield will regenerate through each new stage
B
6
Posts: 14
Reputation: 278

Next

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Nicolas951, tarek2 and 9 guests