android - How to set random color -


this extract of code:

color[] color = new color[3]; color [0] = color.red; color[1] = color.blue; color[2] = color.yellow; stage.getbatch().setcolor(color[rand.nextint()]); 

but "color[rand.nextint()]);" underlined red. don´t know why. there have 4 numbers or instead "color.blue" example in brackets want tint sprite randomly. therefore created array 3 colors. thought giving them numbers , using rand.nextint work. mistake?

you can generate random colors this:

random rnd = new random();  int color = color.argb(255, rnd.nextint(256), rnd.nextint(256), rnd.nextint(256));    

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -