aboutsummaryrefslogtreecommitdiff
path: root/behaviors/MoveBehavior.py
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2011-01-27 17:21:28 -0500
committerGravatar rcoh <rcoh@mit.edu>2011-01-27 17:21:28 -0500
commit4fbb65efee8a214d9a35395e46c582f251ea2a35 (patch)
tree35fc0b137274708d9ccfa7a29b3e7180afa1bda4 /behaviors/MoveBehavior.py
parent890e167b2cd2a438f81a759833fc4f1c876c4142 (diff)
parent328464219a02c014caf1608a27a898900cad8456 (diff)
Merge branch 'mobileapp'
Diffstat (limited to 'behaviors/MoveBehavior.py')
-rw-r--r--behaviors/MoveBehavior.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/behaviors/MoveBehavior.py b/behaviors/MoveBehavior.py
index d2f60a0..e504ca9 100644
--- a/behaviors/MoveBehavior.py
+++ b/behaviors/MoveBehavior.py
@@ -1,7 +1,7 @@
from operationscore.Behavior import *
-import util.ComponentRegistry as compReg
-import util.Geo as Geo
-import util.Strings as Strings
+#import util.ComponentRegistry as compReg
+#import util.Geo as Geo
+#import util.Strings as Strings
class MoveBehavior(Behavior):
"""Moves current location by the x and y components of sensorInput. Uses recurrences to track
@@ -18,9 +18,13 @@ class MoveBehavior(Behavior):
for currRecLoc in currRecLocs:
currDict = dict(currRecLoc)
for sensorInput in sensorInputs:
- currDict['Location'] = (currDict['Location'][0] - sensorInput['x'] * self['XStep'], \
- currDict['Location'][1] + sensorInput['y'] * self['YStep'])
- currDict['Color'] = [sensorInput['r'], sensorInput['g'], sensorInput['b']]
+ 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']
ret.append(currDict)
#print ret
return (ret, ret)