Interpolating integers are not being exact...

jckmcgrawjckmcgraw Member Posts: 647
edited January 2012 in Working with GS (Mac)
Hello everybody,

Here is what I want to happen and what I have working:

-a score attribute to be interpolated up when stuff happens

The problem:

-it isn't adding exactly what I want it to add, and it is even random

My rule states: when actor is touched, interpolate game.score to game.score + 50 over 0.5 seconds. I want it to interpolate so it looks cool. Instead of doing +50 every time, it ranges between +250 — + 290.

It's not a big deal, but it's kind of annoying. Any help would be greatly appreciated.

Comments

  • LiquidGameworksLiquidGameworks Anchorage, AKMember, Sous Chef Posts: 956
    Yo!

    This happens because interpolate will continue updating its value. So, if you did game.score +50, it'll eventually be 65+timing remaining, and so forth. TSB offers a great vid on how to fix this. http://gshelper.com/?p=197
  • POMPOM Member Posts: 2,599
    The thing is you need to store your values to a "temp" attribute before the interpolation of this type,
    So create a self attribute -integer- call it "temp score"
    Now right before you make the interpolation make:
    Change "self.temp score" TO "game.score"
    Then interpolate "game.score" TO "self.temp score"+50

    That should do the trick =)

    Roy.
  • jckmcgrawjckmcgraw Member Posts: 647
    Thanks everybody! Everything works great now!

    Jack McGraw
Sign In or Register to comment.