New High Score Display with Sound
Hi GameSalad community,
I am in the works of completing my first game and I am putting finishing touches on the game. One of those finishing touches, is adding an actor with an image "NEW" whenever a new high score is achieved. I already have custom fonts for my score and high score. All I want is to display the word "NEW" as an image whenever the player achieves a new high score.
This is what I have:
Rule:
if "game.Score" > "game.HighScore"
Do:
set: "game.HighScore" to: "game.Score"
save: "game.HighScore" as: "k"
Rule:
if "game.GameOver" is: "true"
if "game.HighScore" >= "selfe.TurnOn" (TurnOn = 0)
do:
set: "self.color.alpha" to 1
else:
set: "self.color.alpha" to 0
Rule:
if "game.GameOver" is "true"
if "game.HighScore" = "game.Score"
do:
Spawn Actor ("NEW" image)
PlaySound
This way, whenever a high is reached, it spawns the actor "NEW," but the problem is, let's say the high score is 5, if I get 5 again, it spawns the actor again, but it's not a new high score. I only want it to spawn when I get a 6, or higher, in other words, whenever I get a new high score. Any input will be greatly appreciate!
Paul
Comments
Also in this actor, I have:
contrain: "self.image" to: floor((game.HighScore)%(self.Div)/(self.Div/10))
You could make a boolean called "is_new" do something like... if game.score > game.highscore, set game.is_new to 1
Then you could say, if game.is_new=1, spawn NEW
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
You mean make a boolean and set it to "true"? It didn't work, I feel like something is cancelling each other out, but I am not sure what. I attached an image of my programming.
I set the boolean to "NewActor"
I put in a 2 second delay to show Game Over buttons when game over, that's also when I want the "New" high score actor to spawn. Please advise.
http://imgur.com/axmHLl0
All this is on the first zero image of my high score actor, btw.
@Paul I don't understand what the self.TurnOn means. Could you explain?
The self.TurnOn is for not revealing the 0 actor until 0 is 1 or bigger. So if there are zeros before a score, it won't be revealed. But in this case, because this is the first zero, even when it's zero, it will turn on.
Oh! That makes a lot of sense!
@Summation your method worked! I had another actor who had the same rule that was canceling out the rule, rookie mistake... Thanks!
Cheers
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)