mirror of
https://github.com/pcvolkmer/winelounge.git
synced 2025-04-19 18:36:50 +00:00
Move item collision handling into event handler
This prevents item being picked without any move. Without this change, it was sufficient to place the player within boxarea and just wait for new boxes to arrive.
This commit is contained in:
parent
d23dfb969b
commit
cee344c121
@ -61,8 +61,6 @@ fn main() {
|
|||||||
world.update_box_areas();
|
world.update_box_areas();
|
||||||
}
|
}
|
||||||
|
|
||||||
world.handle_collisions();
|
|
||||||
|
|
||||||
world.render(&mut canvas, &texture, &font);
|
world.render(&mut canvas, &texture, &font);
|
||||||
|
|
||||||
::std::thread::sleep(Duration::from_millis(25));
|
::std::thread::sleep(Duration::from_millis(25));
|
||||||
|
@ -112,6 +112,8 @@ impl World {
|
|||||||
Event::KeyUp { .. } => self.execute_command(Command::StopPlayer(player_id)),
|
Event::KeyUp { .. } => self.execute_command(Command::StopPlayer(player_id)),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.handle_item_collisions();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn if_collides_execute(&mut self, commands: Vec<Command>) {
|
fn if_collides_execute(&mut self, commands: Vec<Command>) {
|
||||||
@ -187,7 +189,7 @@ impl World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Handles both, collisions with lounge and any box area
|
/// Handles both, collisions with lounge and any box area
|
||||||
pub fn handle_collisions(&mut self) {
|
pub fn handle_item_collisions(&mut self) {
|
||||||
self.handle_lounge_collisions();
|
self.handle_lounge_collisions();
|
||||||
self.handle_boxarea_collisions();
|
self.handle_boxarea_collisions();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user