Mercurial > fife-parpg
comparison demos/rio_de_hola/scripts/agents/beekeeper.py @ 378:64738befdf3b
bringing in the changes from the build_system_rework branch in preparation for the 0.3.0 release. This commit will require the Jan2010 devkit. Clients will also need to be modified to the new way to import fife.
author | vtchill@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 11 Jan 2010 23:34:52 +0000 |
parents | |
children | 70697641fca3 |
comparison
equal
deleted
inserted
replaced
377:fe6fb0e0ed23 | 378:64738befdf3b |
---|---|
1 from agent import Agent | |
2 from fife import fife | |
3 import random | |
4 | |
5 _STATE_NONE, _STATE_TALK = 0, 1 | |
6 | |
7 class Beekeeper(Agent): | |
8 def __init__(self, model, agentName, layer, uniqInMap=True): | |
9 super(Beekeeper, self).__init__(model, agentName, layer, uniqInMap) | |
10 self.state = _STATE_NONE | |
11 | |
12 def onInstanceActionFinished(self, instance, action): | |
13 self.talk() | |
14 | |
15 def start(self): | |
16 self.facingLoc = self.agent.getLocation() | |
17 c = self.facingLoc.getExactLayerCoordinatesRef() | |
18 c.x += random.randint(-1, 1) | |
19 c.y += random.randint(-1, 1) | |
20 self.talk() | |
21 | |
22 def talk(self): | |
23 self.state = _STATE_TALK | |
24 self.agent.act('talk', self.facingLoc, True) # never calls back |