Issue making image appear after beating Highscore

  • 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.

  • Anyone? I'd really like to learn what i'm doing wrong as i thought i was doing this correctly.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • Thank you so much and thanks for the comments, it's very helpful. I can see where i'm going wrong now.

  • 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?

  • Can anyone else help me out with this please?

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