Renamed Grid.cell_size -> scale
[kaka/rust-sdl-test.git] / src / core / game.rs
index e7eac23..b0d9968 100644 (file)
@@ -173,8 +173,8 @@ impl Object for Character {
     fn update(&mut self, objects: &mut Objects, lvl: &Level, dt: Duration) -> ObjectState {
        let ctrl = self.ctrl.borrow();
 
-       let x = (self.pos.x / lvl.grid.cell_size.width as f64).min(lvl.grid.size.width as f64 - 1.0).max(0.0) as usize;
-       let y = (self.pos.y / lvl.grid.cell_size.height as f64).min(lvl.grid.size.height as f64 - 1.0).max(0.0) as usize;
+       let x = (self.pos.x / lvl.grid.scale.width as f64).min(lvl.grid.size.width as f64 - 1.0).max(0.0) as usize;
+       let y = (self.pos.y / lvl.grid.scale.height as f64).min(lvl.grid.size.height as f64 - 1.0).max(0.0) as usize;
        self.vel += lvl.gravity;
        if lvl.grid.cells[x][y] {
            if self.vel.y > 0.0 && !(ctrl.mov.down() && ctrl.jump.is_pressed) {