diff options
author | rcoh <rcoh@mit.edu> | 2011-01-24 22:44:16 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2011-01-24 22:44:16 -0500 |
commit | 2019fb2895237aa9d86450daaf6d90831189fc13 (patch) | |
tree | 6dd9de45c5c2994c0a6aad2aa808092abb8f99bd /behaviors | |
parent | 39de2bc415e6dc02c68018655962197a38207718 (diff) |
Some new stuff. Fixed a bug where screen responses weren't being synchronized. Now they are.
Added XYMove to do a bouncy behavior.
Diffstat (limited to 'behaviors')
-rw-r--r-- | behaviors/AllPixels.py | 6 | ||||
-rw-r--r-- | behaviors/SingleFrame.xml | 7 | ||||
-rw-r--r-- | behaviors/XYMove.py | 17 |
3 files changed, 30 insertions, 0 deletions
diff --git a/behaviors/AllPixels.py b/behaviors/AllPixels.py new file mode 100644 index 0000000..e155e55 --- /dev/null +++ b/behaviors/AllPixels.py @@ -0,0 +1,6 @@ +from operationscore.Behavior import * +class AllPixels(Behavior): + def processResponse(self, sensorInputs, recursiveInputs): + for sensory in sensorInputs:#TODO: consider replicating the dict + sensory['Location'] = 'True' + return (sensorInputs, recursiveInputs) diff --git a/behaviors/SingleFrame.xml b/behaviors/SingleFrame.xml new file mode 100644 index 0000000..49b5dcf --- /dev/null +++ b/behaviors/SingleFrame.xml @@ -0,0 +1,7 @@ +<Behavior> + <Class>behaviors.AddPixelEvent</Class> + <Args> + <Class>pixelevents.SingleFrameEvent</Class> + <z-index>0</z-index> + </Args> +</Behavior> diff --git a/behaviors/XYMove.py b/behaviors/XYMove.py new file mode 100644 index 0000000..8acbba8 --- /dev/null +++ b/behaviors/XYMove.py @@ -0,0 +1,17 @@ +from operationscore.Behavior import * +import util.Geo as Geo +class XYMove(Behavior): + def processResponse(self, sensor, recurs): + ret = [] + for loc in sensor: + oploc = dict(loc) + self.insertStepIfMissing(oploc) + oploc['Location'] = Geo.addLocations((oploc['XStep'], oploc['YStep']), oploc['Location']) + ret.append(oploc) + return (ret, []) + def insertStepIfMissing(self, data): + if not 'XStep' in data: + data['XStep'] = self['XStep'] + if not 'YStep' in data: + data['YStep'] = self['YStep'] + |