Sphere.Colour
From Liberty Unleashed Wiki
This Sphere class member returns or sets the colour ID of the sphere.
Syntax
You can either return or set a new value using this member:
Colour Sphere.Colour
Sphere.Colour = Colour col
Arguments
- col - This is the pointer to a pre-defined RGB colour object.
Example 1. Returning
This example will message the player with the current RGB colour of the sphere.
function onPlayerFootSphereHit( player, sphere ) { local col = sphere.Colour; MessagePlayer( format( "The current RGB colour of this sphere is: %i, %i, %i", col.r, col.g, col.b ), player ); return 1; }
Notes
The function MessagePlayer and event onPlayerFootSphereHit were used in this example. More info about them in the corresponding pages.
Example 2. Setting
This example will turn the sphere red when a player enters it.
function onPlayerFootSphereHit( player, sphere ) { sphere.Colour = Colour( 255, 0, 0 ); }
Notes
The call onPlayerFootSphereHit was used in in this example. More info about this in the corresponding page.