switch=Rand(1,2)
While Not KeyHit(1)
Select switch
Case 1
ClsColor 255,0,0
Cls
switch = Rand(1,2)
Delay 200
Default
ClsColor 0,0,255
Cls
switch = Rand(1,2)
Delay 200
End Select
Wend
When I run this code, it just selects one color and stays that color. What is preventing it from continuously reselecting colors and changing colors?
I don't know. It's changing colours for me.
If you are using BlitzPlus, then you need to put a Flip() in there before Wend. I had to.
It's not required for me. I tested with Blitz3D and Blitz Basic.
Worked like a charm, although i'm more into the psychedelic.
r=127
g=127
b=127
While Not KeyHit(1)
r1=Rand(0,2)-1
g1=Rand(0,2)-1
b1=Rand(0,2)-1
r=r+r1
g=g+g1
b=b+b1
ClsColor r,g,b
Cls
Text 0,0,"Red:"+r+" Green:"+g+" Blue:"+b
Wend
I think the seernd is a good suggestion. You could run that code 1000 times, in theory, and 1 could come up the first 100 times, or more. Different computers will produce different results. And the rnd seed is always the same upon starting an app in blitz. So your code will produce the EXACT same results everytime you run it, unless you seed the random number generator will a different start point.
You will generally always use millisecs() as your seed because of it's independantly changing value.
Huh, I updated B3D and then tried running it again and it worked fine. Sorry for being a time waster.