mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 12:25:02 +01:00
Fix infinite jumps
This commit is contained in:
parent
6df84ed6e3
commit
be1bc9ca9e
2 changed files with 10 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue