diff options
author | eugue <eug.sun@gmail.com> | 2011-01-28 15:19:40 -0500 |
---|---|---|
committer | eugue <eug.sun@gmail.com> | 2011-01-28 15:19:40 -0500 |
commit | 3cf7f82b2c88181925e01c2736e13d8be7574ab9 (patch) | |
tree | 44b7075dff731cdb57816551c9a47ac6307f7ea0 /behaviors/MoveBehavior.py | |
parent | a08a7f19f2e7b4421f894fcbc00c7c12af031e89 (diff) |
get string data instead of int
Diffstat (limited to 'behaviors/MoveBehavior.py')
-rw-r--r-- | behaviors/MoveBehavior.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/behaviors/MoveBehavior.py b/behaviors/MoveBehavior.py index e504ca9..6f57437 100644 --- a/behaviors/MoveBehavior.py +++ b/behaviors/MoveBehavior.py @@ -13,20 +13,22 @@ class MoveBehavior(Behavior): else: currRecLocs = [{'Location' : (5, 5), 'Color' : [255, 255, 255]}] + #print sensorInputs if sensorInputs: # if input exists, change location ret = [] for currRecLoc in currRecLocs: currDict = dict(currRecLoc) for sensorInput in sensorInputs: - if 'type' in sensorInput and sensorInput['type'] == 1: - currDict['Location'] = (currDict['Location'][0] - sensorInput['x'] * self['XStep'], \ - currDict['Location'][1] + sensorInput['y'] * self['YStep']) - currDict['Color'] = [sensorInput['r'], sensorInput['g'], sensorInput['b']] - #elif sensorInput['type'] == 2: - # currDict['Shake'] = 1 - # currDict['Force'] = sensorInput['force'] + if 'type' in sensorInput and int(sensorInput['type']) == 1: + #currDict['Shake'] = 0 + currDict['Location'] = (currDict['Location'][0] - int(sensorInput['x']) * self['XStep'], \ + currDict['Location'][1] + int(sensorInput['y']) * self['YStep']) + currDict['Color'] = [int(sensorInput['r']), int(sensorInput['g']), int(sensorInput['b'])] + elif int(sensorInput['type']) == 2: + #print sensorInput + currDict['Shake'] = 1 + #currDict['Force'] = sensorInput['force'] ret.append(currDict) - #print ret return (ret, ret) else: # if not, return current recursive location. |