1 from operationscore.Behavior import *
2
3
4
5
7 """Moves current location by the x and y components of sensorInput. Uses recurrences to track
8 current input. @Author: Euguene"""
9
11 if recursiveInputs:
12 currRecLocs = recursiveInputs
13 else:
14 currRecLocs = [{'Location' : (5, 5), 'Color' : [255, 255, 255]}]
15
16 if sensorInputs:
17 ret = []
18 for currRecLoc in currRecLocs:
19 currDict = dict(currRecLoc)
20 for sensorInput in sensorInputs:
21 if 'type' in sensorInput and sensorInput['type'] == 1:
22 currDict['Shake'] = 0
23 currDict['Location'] = (currDict['Location'][0] - sensorInput['x'] * self['XStep'], \
24 currDict['Location'][1] + sensorInput['y'] * self['YStep'])
25 currDict['Color'] = [sensorInput['r'], sensorInput['g'], sensorInput['b']]
26 elif sensorInput['type'] == 2:
27 currDict['Shake'] = 1
28
29 ret.append(currDict)
30
31 return (ret, ret)
32
33 else:
34
35 return (currRecLocs, currRecLocs)
36