From f5c8f07b7fef48ced94e523a6b9442aab6c61da5 Mon Sep 17 00:00:00 2001 From: sparshg <43041139+sparshg@users.noreply.github.com> Date: Sun, 27 Aug 2023 18:45:59 +0530 Subject: [PATCH] prevent groundBody from getting removed on clear_all --- tools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools.py b/tools.py index 78108fe..3f3c4b3 100644 --- a/tools.py +++ b/tools.py @@ -98,7 +98,8 @@ def handleEvents(self, event): elif event.action == 'clear_all': # Get bodies and destroy them too for body in self.game.world.world.bodies: - self.game.world.world.DestroyBody(body) + if body != self.game.world.world.groundBody: + self.game.world.world.DestroyBody(body) # Add ground, because we destroyed it before self.game.world.add.ground()