Changing Color by randomization, possible?

StormtrixStormtrix Member Posts: 256
edited November -1 in Working with GS (Mac)
Morning,
Instead of creating multiple actors or instances of different colors i'd like to be able to just use the built in
color attribute feature of the actors and make the color change when i want it to.
From what I'm seeing you can only do that with either Red,Green, or Blue being either a 1 or a 0 and not
.2 to 1 for more variations of colors.

I've tried the following simple exercise to test it and still only see 1's and 0's and not tenths.

Actor 1
Timer - every .5 sec
Change Attribute: self.color.Red To: random(.2,1)
Change Attribute: self.color.Green To: random(.2,1)
Change Attribute: self.color.Blue To: random(.2,1)

above doesn't work.. just still does 1's or 0's.
Tried addding 2 game attributes
game.Greenn (real)
game.Bluee (integer)

Actor 1
Timer - every .2 sec
Change Attribute: game.Greenn To: random(.2,1)
Change Attribute: game.Bluee To: random(.2,1)
Timer - every .5 sec
Change Attribute: self.color.Red To: random(.2,1)
Change Attribute: self.color.Green To: game.Greenn
Change Attribute: self.color.Blue To: game.Bluee

Doesn't work either..
Any thoughts? Thx.

Comments

  • old_kipperold_kipper Member Posts: 1,420
    try- change attribute self.color.red to random(0,10)/10 -and the same for the other colours

    or for more variation selfcolor.red to random(0,100)/100 --and the same for the other colours

    tried it and it works

    p.s you might want to add a condition so the colours don't get muddy, something like carry on changing unless the total value of r+g+b is greater or equal 1
  • StormtrixStormtrix Member Posts: 256
    awesome! Thanks for the quick assist old_kipper!
    Works great now
Sign In or Register to comment.