enter house (#10)
Reviewed-on: #10 Co-authored-by: luckyturtledev <git@lukas1818.de> Co-committed-by: luckyturtledev <git@lukas1818.de>
This commit is contained in:
parent
1c897d6712
commit
bb37f613ad
5 changed files with 52 additions and 12 deletions
|
@ -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<'_>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue