-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
28 lines (24 loc) · 1.01 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from components.components import (
PositionComponent, HealthComponent, HomeComponent,
FoodComponent, AntTypeComponent, RenderComponent, TaskComponent
)
from components.EggComponent import EggComponent
def create_ant(manager, x, y, ant_type='worker'):
components = [
PositionComponent(x, y),
HealthComponent(),
FoodComponent(),
HomeComponent(home_id=0),
AntTypeComponent(type=ant_type)
]
if ant_type == 'queen':
components.append(EggComponent())
components.append( RenderComponent(color='purple', size=2) )
components.append( TaskComponent( "create_brood", x, y ) )
elif ant_type == 'worker':
components.append( RenderComponent(color='black', size=1) )
components.append( TaskComponent( "explore", x, y ) )
elif ant_type == 'baby':
components.append( RenderComponent(color='gray', size=0.5) )
components.append( TaskComponent( "grow", x, y ) )
return manager.create_entity(components)