Computer Science Canada Random Colours |
| Author: | cam [ Sat Nov 11, 2006 2:49 pm ] |
| Post subject: | Random Colours |
I want to do 3 colours switching from red to black to green. I want to do this as a variable. |
|
| Author: | richcash [ Sat Nov 11, 2006 3:11 pm ] | ||||
| Post subject: | |||||
Something like this?
end loop That's if you want it random, as the post title suggests. This could be for swithching in an orderly fashion.
|
|||||
| Author: | zylum [ Sun Nov 12, 2006 2:52 am ] | ||
| Post subject: | |||
both your code examples dont work to choose one of those three colours at random you could do:
|
|||
| Author: | TokenHerbz [ Sun Nov 12, 2006 5:49 am ] |
| Post subject: | |
zylum, would those colors work with whatdotcolor red, black, green? perhaps later he would want to use a different variety of colors. |
|
| Author: | richcash [ Sun Nov 12, 2006 12:10 pm ] | ||||
| Post subject: | |||||
Oops, I must've deleted too much when I took out my drawing stuff. Here : switching orderly :
randomly :
Use zylum's way for simplicity, but use mine if you want to change the colours later on (or come up with your formula!). |
|||||
| Author: | cam [ Sun Nov 12, 2006 1:43 pm ] |
| Post subject: | |
alright thx |
|
| Author: | zylum [ Sun Nov 12, 2006 4:44 pm ] |
| Post subject: | |
nah, dont use my way the code is not self explanitory and you cant extend it to use other colours. i was just fooling around. unless you are trying to ubfuscate your code then by all means use it |
|