animation fixes

This commit is contained in:
Schrottkatze 2024-11-23 22:24:45 +01:00
parent fb1b776e78
commit fe1af23d90
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc

View file

@ -99,10 +99,10 @@ fn move_player(
controller.translation = Some(Vec2::new(move_x as f32 * 6., 0. - 0.01)); controller.translation = Some(Vec2::new(move_x as f32 * 6., 0. - 0.01));
vel.linvel += Vec2::new(0., move_y as f32 * 3. * METER); vel.linvel += Vec2::new(0., move_y as f32 * 3. * METER);
if moved && move_x != 0 && grounded { if move_x != 0 && grounded {
*anim_state = PlayerAnimations::Walk; *anim_state = PlayerAnimations::Walk;
sprite.flip_x = move_x == -1; sprite.flip_x = move_x == -1;
} else if !moved { } else if move_x == 0 && grounded {
*anim_state = PlayerAnimations::Idle; *anim_state = PlayerAnimations::Idle;
} }
} }