Can you help me figure this out?

0 favourites
  • 13 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I am trying to figure out how to make a custom sound play when the the top score is over taken in the game?

    For example.

    A player has a top score of 1000 and on the second attempt at playing they pass the score with 1200. I am looking for a way to play a custom sound the very moment the player passes the old top score?

    Both "score" and "top score" are global variables.

  • If "score" > "top score" : play sound, with a trigger once so it plays once.

  • If "score" > "top score" : play sound, with a trigger once so it plays once.

    Are you talking about

    System > Compare 2 values > score = bestscore > play sound

    ------

    score and bestscore are the globals I have set.

  • Yep system compare 2 values, score greater than top score, with a trigger once condition.

  • Yep system compare 2 values, score greater than top score, with a trigger once condition.

    Awesome stuff. Thanks!

  • Fixed part of the problem, now I have is... every time the score goes up the sound is playing even with trigger once because the score is going much higher than the top score all the time.

    This is my code..

    There has to be another way around it.

  • just use a boolean instead of trigger once. call it 'triggerNewRecord' or somehting, then set it to false when it hits

  • just use a boolean instead of trigger once. call it 'triggerNewRecord' or somehting, then set it to false when it hits

    I will have a read about boolean's later. I've not used them yet.

    Do you have any example codes of how your theory works? I am having trouble working out how to do what you say on the construct 3 board.

  • just use a boolean instead of trigger once. call it 'triggerNewRecord' or somehting, then set it to false when it hits

    No worries.. I managed to work it out.. it worked! Thank you, much appreciated!

  • Fixed part of the problem, now I have is... every time the score goes up the sound is playing even with trigger once because the score is going much higher than the top score all the time.

    This is my code..

    There has to be another way around it.

    edit: Yeah to trigger once 'ever' you can use another variable looks like it's resolved anyway.

  • just use a boolean instead of trigger once. call it 'triggerNewRecord' or somehting, then set it to false when it hits

    lionz fredriksthlm

    Now I have a bigger problem. I only just realised this as well.Once the boolean is false it also stops the local storage saving the new high score.

    Now I am totally baffled by it. Here are some screen shots.

    This is my code with the boolean

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I figured it out.. I had to put it in 2 seperate events to work properly. In a single event it broke the local storage option.

  • Just set the boolean to a sub event, with the rainbow and sound as actions. The rest, (save score), can be above on the main event.

    But normally it is better to set highscores etc when you finish a lever, or when you die, not every time you get a point..

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