Added reset shortcut.
This commit is contained in:
parent
c8cb1a785d
commit
6da49ee7a6
1 changed files with 9 additions and 0 deletions
|
@ -175,6 +175,10 @@ class FallingSand:
|
||||||
elif event.type == pygame.VIDEORESIZE:
|
elif event.type == pygame.VIDEORESIZE:
|
||||||
self.window_update(event.size)
|
self.window_update(event.size)
|
||||||
|
|
||||||
|
elif event.type == pygame.KEYDOWN:
|
||||||
|
if event.key == pygame.K_r:
|
||||||
|
self.reset_sand_particles()
|
||||||
|
|
||||||
def exit(self):
|
def exit(self):
|
||||||
self.running = False
|
self.running = False
|
||||||
|
|
||||||
|
@ -228,6 +232,11 @@ class FallingSand:
|
||||||
|
|
||||||
return tuple(color)
|
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__":
|
if __name__ == "__main__":
|
||||||
sand = FallingSand()
|
sand = FallingSand()
|
||||||
|
|
Loading…
Reference in a new issue