World Bots![]() Group |
A collection of Bot objects.
The Group object is used to manipulate a collection of Bot objects. Most of the properties and methods of the Bot object are also available to the Group object.
All Bot objects in a Group are also members of the Bots collection object.
The Item method is the default property for the Group object.
The following example creates a new Group of 10 Bot objects called "BlueTeam" and changes some of the properties for members of the group.
Dim BlueTeam as Group
Set BlueTeam = World.Bots.Create (10)
BlueTeam.Shape.Style = vbtStar
BlueTeam.Shape.Color = vbtBlueThis next example initializes a Group with the neighbor Bot objects that are found within a 50 unit radius from a Bot.
Dim Neighbors as Group, Bot as Bot
.
.
Set Neighbors = Bot.GroupNear(50)This next example splits the Bot objects in the Bots collection into two Group objects using the Group method.
Dim FirstHalf as Group, SecondHalf as Group
Bots.Create 20
Set FirstTenGroup = Bots.Group(1,10)
Set SecondTenGroup = Bots.Group(11,20)The last example adds all Bot objects that are older than 55 to the "Retired" Group.
Dim Retired as Group
Set Retired = New Group
.
.
For Each Bot in Bots
If Bot.Age > 55 Then Retired.Add Bot
Next Bot