aboutsummaryrefslogtreecommitdiff
path: root/behaviors
diff options
context:
space:
mode:
authorGravatar eugue <eug.sun@gmail.com>2011-01-25 15:22:24 -0500
committerGravatar eugue <eug.sun@gmail.com>2011-01-25 15:22:24 -0500
commit82f99fc4583ca3cc9861a9fe30990a4a9ef162c4 (patch)
treed568b2284d79df8568201fbcb186bfe070a46684 /behaviors
parent00e836cfa4e2652d724972585d661143142af002 (diff)
working version of IconMover
Diffstat (limited to 'behaviors')
-rw-r--r--behaviors/MoveBehavior.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/behaviors/MoveBehavior.py b/behaviors/MoveBehavior.py
index 9ae98b9..590f0e4 100644
--- a/behaviors/MoveBehavior.py
+++ b/behaviors/MoveBehavior.py
@@ -5,21 +5,19 @@ import util.Strings as Strings
class MoveBehavior(Behavior):
def processResponse(self, sensorInputs, recursiveInputs):
- print 'processing'
- print sensorInputs
if recursiveInputs:
currRecLocs = recursiveInputs
else:
- currRecLocs = [{'Location' : (5, 5)), 'Color' : [255, 255, 255]}]
+ currRecLocs = [{'Location' : (5, 5), 'Color' : [255, 255, 255]}]
if sensorInputs: # if input exists, change location
ret = []
for currRecLoc in currRecLocs:
currDict = dict(currRecLoc)
for sensorInput in sensorInputs:
- currDict['Location'][0] += sensorInput['x'] * self['XStep']
- currDict['Location'][1] += sensorInput['y'] * self['YStep']
- #currDict['Color'] = sensorInput['color']
+ currDict['Location'] = (currDict['Location'][0] - sensorInput['x'] * self['XStep'], \
+ currDict['Location'][1] + sensorInput['y'] * self['YStep'])
+ currDict['Color'] = [sensorInput['r'], sensorInput['g'], sensorInput['b']]
ret.append(currDict)
#print ret
return (ret, ret)