From 51b0d5f0cd4524a977e0bf48ca6f643d85d05d00 Mon Sep 17 00:00:00 2001 From: eugue Date: Fri, 28 Jan 2011 16:10:58 -0500 Subject: reverted the effort to take string inputs. --- behaviors/MoveBehavior.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'behaviors') diff --git a/behaviors/MoveBehavior.py b/behaviors/MoveBehavior.py index 6f57437..6e7fc6a 100644 --- a/behaviors/MoveBehavior.py +++ b/behaviors/MoveBehavior.py @@ -13,22 +13,21 @@ 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 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 + if 'type' in sensorInput and sensorInput['type'] == 1: + currDict['Shake'] = 0 + 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'] ret.append(currDict) + #print ret return (ret, ret) else: # if not, return current recursive location. -- cgit v1.2.3