Random defined colored backgrounds?
justinodunn
Member, PRO Posts: 226
in Tech Support
How do I make it so the color of the background would change randomly amongst a list of colors? (red, purple, blue, green, yellow)
Comments
Perhaps try something like this. If you unlock the actor you can hide it away and directly control the scene colour, but the end result is the same.
You can optimise it a bit but I've gone for easiest for you to follow rather than most efficient possible method.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Thanks that game me some ideas, but how can I make it so the random won't repeat the same values? So that I won't have to same overlapping colored backgrounds
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Cheers
To be honest the linked video is a bit overkill if you just want to avoid the same colour twice in a row, but is great if you want to cycle through all colours in a random order before starting again.
If you just want to avoid 2 of the same colour in a row, throw in a "self.Last" attribute and update it to the current colour each time. When the next random colour is generated, compare it to self.Last and if it's the same, generate again.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I agree haha but sorry I'm not sure how that self last attribute works