Color Property

See Also Applies To Example Model

Sets or returns the object's color. Read/write VbtColor.

Remarks

The VisualBots built-in color constants can be used to easily assign colors.

Use the RGB function to create a color value different from the built-in color constants.

The Color property is actually an alias for the FillColor property of the BotShape or CellShape objects when the property applies to a Bot, Cell, Bots, Cells, Group, or Region object.

If the Color property applies to the Screen object, then it is the background color that is displayed when Cell objects are not visible. When the Visible property of a Cell is set to True, then the FillColor of the Cell is displayed.

Example

The following example creates a checkered board pattern by manipulating the Color property of Cells collection object.

Private Sub World1_OnSimBegin(ByVal World As World, ByVal Worms As Bots, ByVal Cells As Cells)
Cells.Color = vbtBlack
For Each Cell in Cells
     If IsEven(Cell.RowIndex + Cell.ColumnIndex) then
          Cell.Color = vbtRed
     End If
Next Cell
End Sub

Function IsEven(ByVal Number as Long) as Boolean
     If Number Mod 2 = 0 Then IsEven = true Else IsEven = false
End Function