flip wizard sprite to match direction regardless of hat state

This commit is contained in:
Corwin 2022-06-21 02:07:38 +01:00
parent e0e6686ac3
commit dc722d5199

View file

@ -503,6 +503,22 @@ impl<'a> Player<'a> {
_ => (0, 8).into(),
};
match self.facing {
agb::input::Tri::Negative => {
self.wizard.sprite.set_hflip(true);
self.hat
.sprite
.set_sprite(controller.sprite(hat_base_tile.sprite(5)));
}
agb::input::Tri::Positive => {
self.wizard.sprite.set_hflip(false);
self.hat
.sprite
.set_sprite(controller.sprite(hat_base_tile.sprite(0)));
}
_ => {}
}
match self.hat_state {
HatState::Thrown => {
// hat is thrown, make hat move towards wizard
@ -554,21 +570,6 @@ impl<'a> Player<'a> {
self.hat_slow_counter = 0;
self.hat_left_range = false;
self.hat.position = self.wizard.position - hat_resting_position;
match self.facing {
agb::input::Tri::Negative => {
self.wizard.sprite.set_hflip(true);
self.hat
.sprite
.set_sprite(controller.sprite(hat_base_tile.sprite(5)));
}
agb::input::Tri::Positive => {
self.wizard.sprite.set_hflip(false);
self.hat
.sprite
.set_sprite(controller.sprite(hat_base_tile.sprite(0)));
}
_ => {}
}
}
HatState::WizardTowards => {
self.hat.sprite.set_sprite(