X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fcore%2Fgame.rs;h=3e017b168e401759a68b4397d4ee0eeddf50af33;hb=c80ba7f72596437b28540f463b952e6dcbce6295;hp=55bb80cb688a7b690daf0cefa0eec7371480a3fa;hpb=a6b57e450092f390103915bb8b936ceb9a116b03;p=kaka%2Frust-sdl-test.git diff --git a/src/core/game.rs b/src/core/game.rs index 55bb80c..3e017b1 100644 --- a/src/core/game.rs +++ b/src/core/game.rs @@ -57,6 +57,9 @@ impl AppState for GameState { Event::KeyDown { keycode: Some(Keycode::KpMinus), .. } => { self.world.level.decrease_iteration(); } + Event::KeyDown { keycode: Some(Keycode::KpEnter), .. } => { + self.world.level.filter_regions(); + } _ => {} } } @@ -231,16 +234,6 @@ impl Object for Boll { self.vel += lvl.gravity; self.pos += self.vel; - if self.pos.y >= lvl.ground { - if self.bounces == 0 { - return Dead - } else { - self.bounces -= 1; - self.pos.y = lvl.ground; - self.vel.y = -self.vel.y; - } - } - let x = (self.pos.x / lvl.grid.cell_size as f64).min(lvl.grid.width as f64 - 1.0).max(0.0) as usize; let y = (self.pos.y / lvl.grid.cell_size as f64).min(lvl.grid.height as f64 - 1.0).max(0.0) as usize; if lvl.grid.cells[x][y] {