enter house (#10)
Some checks failed
Rust / rustfmt (push) Successful in 29s
Rust / clippy (push) Failing after 2m25s
Rust / build (push) Successful in 2m54s

Reviewed-on: #10
Co-authored-by: luckyturtledev <git@lukas1818.de>
Co-committed-by: luckyturtledev <git@lukas1818.de>
This commit is contained in:
luckyturtledev 2024-07-07 11:21:08 +00:00 committed by LuckyTurtleDev
parent 1c897d6712
commit bb37f613ad
5 changed files with 52 additions and 12 deletions

View file

@ -1,4 +1,11 @@
use crate::{game::ZLayer, State};
use crate::{
activities::{
house::{self, HouseState},
Activity
},
game::ZLayer,
State
};
use comfy::{
draw_circle, draw_rect_outline, draw_sprite, error, info, is_key_down,
main_camera_mut, EngineContext, IVec2, KeyCode, Vec2, RED, WHITE
@ -146,6 +153,16 @@ fn update_move_player(state: &mut State) {
y: requested_pos_diff.y as _
};
state.ghost.overworld_pos_last_update = now;
//move into house if player stepp at door
{
let current_tile = state.overworld.get_or_generate_tile(tile_pos);
if current_tile.can_enter_house() {
info!("enter house at {tile_pos}");
state.activity = Activity::House(tile_pos);
state.house_mut(); // gen new house
}
}
}
pub fn update(state: &mut State, _ctx: &mut EngineContext<'_>) {