fix jittery whimsical star during pause

This commit is contained in:
dawnDus 2022-01-20 21:21:34 -05:00
parent b181f9293f
commit c9f11d6c9f
No known key found for this signature in database
GPG Key ID: 972AABDE81848F21
2 changed files with 9 additions and 3 deletions

View File

@ -38,6 +38,13 @@ impl WhimsicalStar {
active_star: 0,
}
}
pub fn set_prev(&mut self) {
for iter in 0..=2 {
self.star[iter].prev_x = self.star[iter].x;
self.star[iter].prev_y = self.star[iter].y;
}
}
}
impl GameEntity<(&Player, &mut BulletManager)> for WhimsicalStar {
@ -76,9 +83,6 @@ impl GameEntity<(&Player, &mut BulletManager)> for WhimsicalStar {
self.star[iter].vel_x = self.star[iter].vel_x.clamp(-0xA00, 0xA00);
self.star[iter].vel_y = self.star[iter].vel_y.clamp(-0xA00, 0xA00);
self.star[iter].prev_x = self.star[iter].x;
self.star[iter].prev_y = self.star[iter].y;
self.star[iter].x += self.star[iter].vel_x;
self.star[iter].y += self.star[iter].vel_y;

View File

@ -1715,6 +1715,8 @@ impl Scene for GameScene {
}
}
self.whimsical_star.set_prev();
self.inventory_dim += 0.1
* if state.textscript_vm.mode == ScriptMode::Inventory {
state.frame_time as f32