Interpolate Score Stops Working When it is Overloaded? (Not Quite Sure)
Hello Everybody,
My "user" problem (what you see), is that the score will randomly stop going up when you touch stars.
Behind the scenes (GS), I have 2 integer attributes. game.tempscore, and game.score.
Rule: When star is pressed, change attribute game.tempscore to game.tempscore + 100
In my control actor, I have this rule:
When game.tempscore > game.score, interpolate game.score to game.tempscore over a duration of 0.4 seconds.
Everything works totally fine when there are only one or two stars coming down the screen, and you touch them individually (not at the same time). Once more and more come down though, and (I think) you touch two or 3 very close together (in timing), game.score stops interpolating to game.tempscore. game.tempscore keeps going up, but the game.score (which is being displayed), stops moving.
Any help is greatly appreciated,
Jack McGraw
My "user" problem (what you see), is that the score will randomly stop going up when you touch stars.
Behind the scenes (GS), I have 2 integer attributes. game.tempscore, and game.score.
Rule: When star is pressed, change attribute game.tempscore to game.tempscore + 100
In my control actor, I have this rule:
When game.tempscore > game.score, interpolate game.score to game.tempscore over a duration of 0.4 seconds.
Everything works totally fine when there are only one or two stars coming down the screen, and you touch them individually (not at the same time). Once more and more come down though, and (I think) you touch two or 3 very close together (in timing), game.score stops interpolating to game.tempscore. game.tempscore keeps going up, but the game.score (which is being displayed), stops moving.
Any help is greatly appreciated,
Jack McGraw
Comments
Try:
Rule: When star is pressed:
- change attribute game.tempscore to game.tempscore + 100
- interpolate game.score to game.tempscore
Also, and this is just a suggestion based on my personal preference - I would switch the values for score and tempscore around. You should use tempscore to represent the displayed score (the one being interpolated) and score to represent your actual score, which is the one being immediately added to. That way you know you should always use the actual "score" to do things like saving highscores. It just makes more sense than using something named "tempscore" in my opinion. Sorry, I'm a CS student, and variable names are a big deal to us! :P
BTW...the reason that the game.tempscore > game.score conditional check is a problem is because those conditional checks only repeat the behaviors inside the Rule if the condition changes. So what's happening is that you are collecting a star and at that point the tempscore is > the score. Then if you collect another star before the game.score is done interpolating, it will still be < the tempscore, so the Rule is not triggered again, because the condition has not changed. Furthermore, because the game.score doesn't interpolate the second time, the condition will never be able to change again, because the tempscore will always be > the score after that point, so the score stops counting up. This is VERY important to consider when creating those logical conditional checks.
Let me know if that's not clear enough...
@jckmcgraw i assume you figured this out a while back...jan 19th...didn't see that at first! :P
I fixed this with timer: every 0.1 second interpolate game.score to game.tempscore.
thank you!!!!