diff options
author | Tom Barrett <tom@tombarrett.xyz> | 2021-02-03 18:34:59 +0100 |
---|---|---|
committer | Tom Barrett <tom@tombarrett.xyz> | 2021-02-03 18:34:59 +0100 |
commit | e6bfdeb1065f55a9705906b2933fa05261ff1c62 (patch) | |
tree | 5438313675c91137a5a129473dd9386c209fe838 /src | |
parent | 46ab0e5df51cdf25e3df32b6e395604e86375a26 (diff) |
parts fall from top
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 9 |
1 files changed, 9 insertions, 0 deletions
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(()) } |