From e6bfdeb1065f55a9705906b2933fa05261ff1c62 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Wed, 3 Feb 2021 18:34:59 +0100 Subject: parts fall from top --- src/main.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 18dd403..59a4f8c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -268,6 +268,14 @@ impl Game { } } + fn update_feeding(&mut self) { + for i in 0..COLUMNS { + if self.grid[0][i].occupant == Occupant::None { + self.grid[0][i].occupant = rand::random(); + } + } + } + fn update_frames(&mut self) { for row in self.grid.iter_mut() { for cell in row.iter_mut() { @@ -315,6 +323,7 @@ impl EventHandler for Game { self.update_explosions(); self.update_frames(); self.update_dropping(); + self.update_feeding(); Ok(()) } -- cgit v1.2.3