Added reset shortcut.

This commit is contained in:
The Wobbler 2024-02-26 13:12:20 +01:00
parent c8cb1a785d
commit 6da49ee7a6

View file

@ -175,6 +175,10 @@ class FallingSand:
elif event.type == pygame.VIDEORESIZE:
self.window_update(event.size)
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_r:
self.reset_sand_particles()
def exit(self):
self.running = False
@ -228,6 +232,11 @@ class FallingSand:
return tuple(color)
def reset_sand_particles(self):
self.falling_sand_particles.clear()
self.sand_surface.fill(self.gray)
self.rainbow_data = [[255, 40, 40], 0]
if __name__ == "__main__":
sand = FallingSand()