Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools.py
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2014-01-19 17:42:51 (GMT)
committer Walter Bender <walter@sugarlabs.org>2014-01-19 17:42:51 (GMT)
commit8de9dc0e92b47375e44c4edfad926b8e5143c60f (patch)
tree9c1fa6c8f0191408a0566aabe8cb4a356a584046 /tools.py
parentee2aa6ae2beda3d4182470a3d6796d64e9bd791d (diff)
adding support for collaboration -- so far, just circle objects
Diffstat (limited to 'tools.py')
-rw-r--r--tools.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/tools.py b/tools.py
index 1d0211f..7a59475 100644
--- a/tools.py
+++ b/tools.py
@@ -185,13 +185,21 @@ class CircleTool(Tool):
self.pt1 = tuple_to_int(event.pos)
elif event.type == MOUSEBUTTONUP:
if event.button == 1:
- self.game.world.add.ball(
- self.pt1, self.radius,
- dynamic=True, density=self.palette_data['density'],
- restitution=self.palette_data['restitution'],
- friction=self.palette_data['friction'])
+ self.constructor(self.pt1, self.radius,
+ self.palette_data['density'],
+ self.palette_data['restitution'],
+ self.palette_data['friction'])
self.pt1 = None
+ def constructor(self, pos, radius, density, restitution, friction,
+ share=True):
+ self.game.world.add.ball(pos, radius, dynamic=True,
+ density=density, restitution=restitution,
+ friction=friction)
+ if share and self.game.activity.we_are_sharing:
+ data = json.dumps([pos, radius, density, restitution, friction])
+ self.game.activity.send_event('C:' + data)
+
def draw(self):
Tool.draw(self)
# Draw a circle from pt1 to mouse