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] {