Skip to content

Commit bf12693

Browse files
sparshgtchx84
authored andcommitted
manifest: Add patch to fix clear_all button
1 parent 2f3fab0 commit bf12693

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

org.sugarlabs.Physics.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@
111111
"type": "patch",
112112
"path": "physics-port.patch"
113113
},
114+
{
115+
"type": "patch",
116+
"path": "physics-fix-destroy.patch"
117+
},
114118
{
115119
"type": "patch",
116120
"path": "physics-monitors.patch"

physics-fix-destroy.patch

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/tools.py b/tools.py
2+
index 78108fe..3f3c4b3 100644
3+
--- a/tools.py
4+
+++ b/tools.py
5+
@@ -98,7 +98,8 @@ class Tool(object):
6+
elif event.action == 'clear_all':
7+
# Get bodies and destroy them too
8+
for body in self.game.world.world.bodies:
9+
- self.game.world.world.DestroyBody(body)
10+
+ if body != self.game.world.world.groundBody:
11+
+ self.game.world.world.DestroyBody(body)
12+
13+
# Add ground, because we destroyed it before
14+
self.game.world.add.ground()

0 commit comments

Comments
 (0)