diff options
Diffstat (limited to 'behaviors/MoveBehavior.py')
-rw-r--r-- | behaviors/MoveBehavior.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/behaviors/MoveBehavior.py b/behaviors/MoveBehavior.py new file mode 100644 index 0000000..9ae98b9 --- /dev/null +++ b/behaviors/MoveBehavior.py @@ -0,0 +1,29 @@ +from operationscore.Behavior import * +import util.ComponentRegistry as compReg +import util.Geo as Geo +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]}] + + 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'] + ret.append(currDict) + #print ret + return (ret, ret) + + else: # if not, return current recursive location. + #print currRecLocs + return (currRecLocs, currRecLocs) |