The RGB function
========
RGB stands for Red Green Blue.
It's a function. A function is normally a command where you give it some data, and it gives you back some data.
For example:
var1=object exist(1)
If the object number 1 existed, var1 would now have 1 stored inside it. Otherwise, 0.
RGB is the same thing, only its used for generating colour values.
A colour is a number. Yup, a number.
you can't just say color object 1,red
And the problem is, each command accounts for the bazillions of numbers there are in the world (in 16bit mode, its 32768 or something).
How are you supposed to know which number means red?
You're not.
RGB takes three parameters;
RGB ( Red, Green, Blue)
Each value (red green and blue) can take a number from 0 to 255.
So if you wanted full red nothing else, you could do RGB(255,0,0)
If you wanted black, you could do RGB(0,0,0).
White, RGB(255,255,255).
And RGB generates a meaningless number that means something.
So you want a cube by the name of object 1 to be red:
Make Object Cube 1,100.0
Color Object 1,RGB(255,0,0)
Wait key
end
Voila! One red cube program, that quits when you hit a key.
(Note: If you're making a pro. game, as it says in JessTicular's speed up tips thingy, you can get about a 5% speed increase or something by using Texture object, because Color Object makes a big texture that's all that colour, whereas you could just make one of size 1x1
)
[img src=http://blanky.pt-web.net/ddd.gif] >::p