fix house entering
This commit is contained in:
parent
33b301a410
commit
9bfa6e2669
1 changed files with 13 additions and 9 deletions
|
@ -146,9 +146,22 @@ fn update_move_player(state: &mut State, ctx: &mut EngineContext<'_>) {
|
|||
y: requested_pos_diff.y as _
|
||||
};
|
||||
state.ghost.overworld_pos_last_update = now;
|
||||
}
|
||||
|
||||
pub fn update(state: &mut State, ctx: &mut EngineContext<'_>) {
|
||||
let mut camera = main_camera_mut();
|
||||
camera.center = state.ghost.overworld_pos;
|
||||
camera.zoom = 30.0;
|
||||
|
||||
// move player
|
||||
update_move_player(state, ctx);
|
||||
|
||||
//move into house if player stepp at door
|
||||
{
|
||||
let tile_pos = IVec2 {
|
||||
x: state.ghost.overworld_pos.x.round() as _,
|
||||
y: state.ghost.overworld_pos.y.round() as _
|
||||
};
|
||||
let current_tile = state.overworld.get_or_generate_tile(tile_pos);
|
||||
if current_tile.can_enter_house() {
|
||||
info!("enter house at {tile_pos}");
|
||||
|
@ -156,15 +169,6 @@ fn update_move_player(state: &mut State, ctx: &mut EngineContext<'_>) {
|
|||
state.house_mut(ctx); // gen new house
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update(state: &mut State, ctx: &mut EngineContext<'_>) {
|
||||
let mut camera = main_camera_mut();
|
||||
camera.center = Vec2::ZERO;
|
||||
camera.zoom = 30.0;
|
||||
|
||||
// move player
|
||||
update_move_player(state, ctx);
|
||||
|
||||
// generate more chunks if needed
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue