From 871fb025218e24397278efea777407da87ebadee Mon Sep 17 00:00:00 2001 From: Wobbl Date: Mon, 15 Jul 2024 19:59:10 +0200 Subject: [PATCH] Fixed da stuubid crashes. --- falling_sand.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) mode change 100644 => 100755 falling_sand.py diff --git a/falling_sand.py b/falling_sand.py old mode 100644 new mode 100755 index d883e8d..676e291 --- a/falling_sand.py +++ b/falling_sand.py @@ -25,6 +25,7 @@ class FallingSandParticle: self.not_moving = 0 x, y = start_pos + self.app.matrix[x, y] = self.color def update(self): @@ -79,12 +80,13 @@ class FallingSandParticle: return - self.not_moving = 0 + if not x > self.app.sand_surface.get_width() - 2:# and not x < 0: + self.not_moving = 0 - self.pos = (x, y) + self.pos = (x, y) - self.app.matrix[ox, oy] = self.app.gray - self.app.matrix[x, y] = self.color + self.app.matrix[ox, oy] = self.app.gray + self.app.matrix[x, y] = self.color class FallingSand: @@ -206,7 +208,7 @@ class FallingSand: bx += ax by += ay - if self.matrix[bx, by] == self.sand_surface.map_rgb(self.gray) and bx % 2 == 0 and by % 2 == 0: + if not bx > self.sand_surface.get_width() - 2 and self.matrix[bx, by] == self.sand_surface.map_rgb(self.gray) and bx % 2 == 0 and by % 2 == 0: self.falling_sand_particles.append(FallingSandParticle(self, (bx, by), color)) def rainbow(self):