Issue making image appear after beating Highscore

Get help using Construct 2

Post » Fri May 30, 2014 5:20 pm

I've got a issue with making a 'New Highscore' image appear when the highscore is beaten in my game.

I've got a sprite outside the layout and when a highscore is beaten, i've set the sprite position to appear on screen but It's very tempermental and seem to only work when it feels like it. On some occasions it will work fine and appear when the score is beaten but then there are times where even if the score is beaten, the sprite will not appear.

What i've done is on the Game Over event sheet is the following -

Condition
System(Every Tick)
System(TotalDistance > WebStorage.LocalValue("GameHighscore")

Action
Sprite (Set Position to (321,102))

I've provided a capx file and that quickly made so it makes the 2mb limit.

I'm not sure what the issue is and would appriciate any help on this.
You do not have the required permissions to view the files attached to this post.
B
5
S
2
Posts: 116
Reputation: 867

Post » Sun Jun 01, 2014 11:52 am

Anyone? I'd really like to learn what i'm doing wrong as i thought i was doing this correctly.
B
5
S
2
Posts: 116
Reputation: 867

Post » Sun Jun 01, 2014 1:07 pm

You had a few logic issues and inconsistencies, so I've uploaded a fixed up version with comments so you can see some general improvements on your code.

The actual issue was that you weren't converting your WebStorage.LocalValue("HighScore") from a string to an integer, so it couldn't be compared with the global variable TotalDistance.
You do not have the required permissions to view the files attached to this post.
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Sun Jun 01, 2014 8:09 pm

Thank you so much and thanks for the comments, it's very helpful. I can see where i'm going wrong now.
B
5
S
2
Posts: 116
Reputation: 867

Post » Mon Jun 02, 2014 3:48 pm

I thought that the problem had been resolved but i'm still getting the same issue where the image/sprite only appears on some occasions rather than all the time.

Can you check if there is anything else going wrong?
B
5
S
2
Posts: 116
Reputation: 867

Post » Tue Jun 03, 2014 9:56 pm

Can anyone else help me out with this please?
B
5
S
2
Posts: 116
Reputation: 867


Return to How do I....?

Who is online

Users browsing this forum: MrSkailo and 23 guests