diff --git a/falling_sand.py b/falling_sand.py index 8e047cb..014b3c2 100755 --- a/falling_sand.py +++ b/falling_sand.py @@ -213,7 +213,7 @@ class FallingSand: bx += ax by += ay - 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: + if bx < self.sand_surface.get_width() - 2 and by < self.sand_surface.get_height() -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):