How to play a sound every time the attribute game.score change
LordTarantor
Member, PRO Posts: 890
Hi everybody:
I am trying to add a sound every time the score goes up but I just cant figure it out. I tried to put in the score actor where the display text is, a rule that say when attribute game.core = to game.score+1 play sound. That does not work.
Can some one tell me what the rule should be? or how to do this?
I am trying to add a sound every time the score goes up but I just cant figure it out. I tried to put in the score actor where the display text is, a rule that say when attribute game.core = to game.score+1 play sound. That does not work.
Can some one tell me what the rule should be? or how to do this?
Comments
or whatever rule you have the changes the score have a play sound as well.
so if you have when actor collides with bullet change score to score +1 , add a play sound it that rule
game.score = game.score+1 i think its wrong
you also can put a overlap or collides on the actor that triggers the game score to go up. so that when it is touched by the object causing the score to change it also plays a sound. I did that on a pinball type scene.
The thing is that I have now hundreds of instances of a prototype, so I will have to go to every single one of them to add the rule to make the sound. That is why I am asking if there is a way to do it directly in a rule when the score changes.
I tried when the score is not equal to 0 but it did it only one time because then the score was not 0.
Is there anothe way?
attribute game.score = game.score +1
Play sound
if it is something else then the rule needs to be adjusted accordingly.
game.score = game.score + ? (whatever you are using)
play sound
That one doesn't work.
I mean, mathematically, the score can never = +1 of itself. right?
i think you would have to sample the score every 0.1 seconds or so. then, compare that to the actual score.
so, create a second game attribute. something like game.compareScore (can't think of anything better at the moment).
Timer (Every 0.1):
change game.compareScore to game.Score
Rule:
if game.Score = game.compareScore+1
play sound
or
Rule:
if game.Score does not equal game.compareScore
play sound
not sure which would work better for you....haven't tested it, but i think this would work.
Thanks a lot.
I used the rule when game.score is not equal to game.comparescore.
It works amazing.
Thank you