Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools.py
diff options
context:
space:
mode:
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