Fixed da stuubid crashes.

This commit is contained in:
The Wobbler 2024-07-15 19:59:10 +02:00
parent aba7f137fb
commit 871fb02521

4
falling_sand.py Normal file → Executable file
View file

@ -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,6 +80,7 @@ class FallingSandParticle:
return
if not x > self.app.sand_surface.get_width() - 2:# and not x < 0:
self.not_moving = 0
self.pos = (x, y)
@ -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):