Constantly Interpolate Colors

nicolastonicolasto Member Posts: 3
edited December 2011 in Working with GS (Mac)
Hi guys! First time poster here..

I'm trying to create a progress bar that every 5 seconds interpolates it's 3 colors to a randomly generated color.

The actor has 3 attributes (NewRed,NewBlue,NewGreen). The initial Colors of this actor and it's 3 attributes are (0,0,0) and this is what I have so far:

Rule:
When All of the following conditions:
self.Color.Red==NewRed
self.Color.Blue==NewBlue
self.Color.Green==NewGreen
Then:
Change Atributte NewRed,NewBlue,NewGreen=random(0,1)
Interpolate self.Color.Blue/Red/Green to NewBlue/Red/Green in 5 seconds.

The problem is that the bar actually changes it's color in the first 5 seconds, but afterwards the color remains the same. I'm having some trouble understanding why this happens because after the first 5 seconds, the conditions should be valid (just like they are when the game starts).

Any help would be greatly aprecciated!
Nico

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    edited December 2011
    Random only outputs an integer so it will always round up to 1 or down to 0.

    What you'll want to do it

    (random(0,100)/100)

    that should give a much better range.
  • nicolastonicolasto Member Posts: 3
    edited December 2011
    Actually I'd done exactly that already but still doesn't work. Any thougts?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited December 2011
    posted this a while ago, itll help you out

    http://cookbook.gamesalad.com/#question=4e29b1e9db04ec4d83000179

    just instead of having change attribute: self.change.Color to (self.change.color+1)%3

    have change attribute self.change.Color to random(0,2)
  • nicolastonicolasto Member Posts: 3
    I got it, the problem was that this rule executed itself just once. I moved the set of rules into a timer that triggers every 0.1 seconds and did the trick. Thanks anyways!
Sign In or Register to comment.