Fix infinite jumps

This commit is contained in:
crumblingstatue 2023-04-03 22:11:07 +02:00
parent 6df84ed6e3
commit be1bc9ca9e
2 changed files with 10 additions and 1 deletions

View file

@ -9,6 +9,7 @@ pub struct Player {
pub col_en: MobileEntity,
pub vspeed: f32,
pub hspeed: f32,
pub jumps_left: u8,
}
impl Player {
@ -17,6 +18,7 @@ impl Player {
col_en: MobileEntity::from_pos_and_bb(vec2(pos.x as i32, pos.y as i32), vec2(15, 24)),
vspeed: 0.0,
hspeed: 0.0,
jumps_left: 0,
}
}
pub fn center_tp(&self) -> TilePos {
@ -25,4 +27,7 @@ impl Player {
y: (self.col_en.en.pos.y / TILE_SIZE as i32) as TilePosScalar,
}
}
pub fn can_jump(&self) -> bool {
self.jumps_left > 0
}
}