Help with interpolate bug that's driving me nuts :P

Hi Saladers,
I'm using an actor to fill a progress bar by starting off 10px wide and then as the player collects snowballs the progress bar gets wider with the formula: interpolate self.width = 10+30*snowballsEaten

However, for whatever reason it isn't working.... This seems pretty straight forward but I'm not sure why I can't find the bug.. I've tried lots of things.

I'm sure that the snowballsEaten counter is going up because if snowballsEaten >= snowballsNeeded then the game stops as planned... thus verifying that snowballsEaten counter is working.

Have a look at this screenshot of my backend "code".... why isn't interpolate working with self.width? By the way, if I replace 10+30*snowballsEaten with 10+30*3 it works. So I know that interpolate can work for width..but it isn't recognizing that snowballsEaten has incremented.

interpolate help

Thanks guys and gals :)
.B.

Comments

  • adlaimadlaim Member Posts: 68
    ابتعد عن استعمال المعادلات الرياضية عند استخدام interpolate .
    اصنع self.attribute .
    ثم ضع فيها المعادلة الرياضية التي تريد .
    And Now ::
    Make interpolate
    Self.size.width TO self.attribute

    ^^ I'm not good for English..
    ^^Translate this from arabic Language :)
  • thumbfrenzylabzthumbfrenzylabz Member, PRO Posts: 50
    Thanks for your response :) I was able to translate it. For everyone else, so they can know what you said without translating.

    @adlaim said "Stay away from the use of mathematical formulas when using interpolate. Create self.attribute. Then place the mathematical equation that you want. And Now :: Make interpolate Self.size.width TO self.attribute"

    So, I tried it... and it still isn't working. I set self.barWidth = 10+30*(snowballsEaten/snowballsNeeded)
    then I used interpolate self.width to self.barWidth

    Still not working... hmmm
  • -Timo--Timo- Member Posts: 2,313
    I don't know really understand what you want but maby you have to use constrain attribute?
  • FajlajpFajlajp Member Posts: 666
    edited July 2013
    I will take a look at this. Wait.
    What´s the issue? Does it not add. Is that what you saying?
  • FajlajpFajlajp Member Posts: 666
    I think I found the issue in your rules just by looking at it. You don´t say when it should interpolate. That´s why it not working I think.
    Here is how I would do to say when to interpolate.
    Make a new attribute(integer) and call it SnowBallsCurrentEaten(or something)
    And then make a rule that says
    If attribute game.SnowballsCurrentEaten is not equal to game.SnowballsEaten
    Change attribute game.SnowballsEaten to game.SnowballsCurrentEaten
    Interpolate self.size.width to 10+30*snowballsEaten.

    I did check it out my self and it did work :)
    //Fajlajp
  • -Timo--Timo- Member Posts: 2,313
    now I understand what you want xD that should work :) good thinking @fajlajp
  • thumbfrenzylabzthumbfrenzylabz Member, PRO Posts: 50
    You earn an +1 insightful @Fajlajp Good catch. I made your suggested edit and it worked straightaway.

    You know, I did even think of that possibility but I was thinking that um..duh no that isn't necessary because it will always interpolate based on the current value of snowballsEaten... I was wrong but I should have checked it... *shrug*

    Thanks for taking the time to reply :)

    The good news is LEVEL 1 COMPLETE! YES!

    The following 59 (or so) levels of my game should be faster now!
  • FajlajpFajlajp Member Posts: 666
    Great :) Just send me a pm if you get some more trouble.
    //Fajlajp
Sign In or Register to comment.