playMaker

Author Topic: Need some help with Picking Random Colors! [SOLVED]  (Read 1250 times)

rizwanash

  • Junior Playmaker
  • **
  • Posts: 61
Need some help with Picking Random Colors! [SOLVED]
« on: May 17, 2019, 12:34:16 PM »
Hello Guys,
I am having some trouble getting random colors for an object, What i want is i have a scene with a sphere in different locations, same sphere being copied and same material, i would like to give all of them random colors whenever the level starts so they do not look the same.

I would like save my list of colors in an Array and then use those as random.

How to achieve that ? Thank you in advance :)
« Last Edit: May 17, 2019, 03:44:45 PM by Alex Chouls »

drown

  • Junior Playmaker
  • **
  • Posts: 58
Re: Need some help with Picking Random Colors!
« Reply #1 on: May 17, 2019, 01:30:44 PM »
You already mention the answer in your question !

Just make an array containing all the possible colors your sphere can get. I wouldnt recommend random colors as you game should use some sort of art style / colour palettes that work well together.

Store those colors in your array and then make a fsm that uses "Array Get Random" to fetch a random colour from your palette. You could then make another array containing all your spheres and then loop through that array and assign a random color for earch entry in that list. That way you don't need as many FSMs as you have spheres.

rizwanash

  • Junior Playmaker
  • **
  • Posts: 61
Re: Need some help with Picking Random Colors!
« Reply #2 on: May 17, 2019, 02:29:28 PM »
Hi, Thank you for replying, I am still a beginner to PM, Can you please add little more details for that ? I am using ArrayMaker Package here. Thanks

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3998
  • Official Playmaker Support
    • LinkedIn
Re: Need some help with Picking Random Colors!
« Reply #3 on: May 17, 2019, 03:01:19 PM »
I would use the built-in arrays for this.

Create an Array variable and set the Array Type to Color.
Fill in the colors you want to pick from.
Then use Array Get Random to get a random color from this array.

More about arrays:
https://hutonggames.fogbugz.com/f/page?W1243


rizwanash

  • Junior Playmaker
  • **
  • Posts: 61
Re: Need some help with Picking Random Colors!
« Reply #4 on: May 17, 2019, 03:28:43 PM »
Awesome Thanks :) Built in Array colors worked just fine.