summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2021-02-03 18:34:59 +0100
committerTom Barrett <tom@tombarrett.xyz>2021-02-03 18:34:59 +0100
commite6bfdeb1065f55a9705906b2933fa05261ff1c62 (patch)
tree5438313675c91137a5a129473dd9386c209fe838 /src/main.rs
parent46ab0e5df51cdf25e3df32b6e395604e86375a26 (diff)
parts fall from top
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs9
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(())
}