fix camera inside houses
This commit is contained in:
parent
3816dbac77
commit
b9e065058f
1 changed files with 4 additions and 1 deletions
|
@ -3,7 +3,7 @@ mod grid;
|
||||||
mod player;
|
mod player;
|
||||||
mod room;
|
mod room;
|
||||||
|
|
||||||
use comfy::{random_i32, EngineContext};
|
use comfy::{main_camera_mut, random_i32, vec2, EngineContext};
|
||||||
use grid::Grid;
|
use grid::Grid;
|
||||||
use log::error;
|
use log::error;
|
||||||
use player::Player;
|
use player::Player;
|
||||||
|
@ -62,6 +62,9 @@ pub fn draw(state: &crate::State, _ctx: &comfy::EngineContext<'_>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(state: &mut crate::State, ctx: &mut comfy::EngineContext<'_>) {
|
pub fn update(state: &mut crate::State, ctx: &mut comfy::EngineContext<'_>) {
|
||||||
|
let mut camera = main_camera_mut();
|
||||||
|
camera.center = vec2(0.0, 0.0);
|
||||||
|
|
||||||
let house = state.house_mut(ctx);
|
let house = state.house_mut(ctx);
|
||||||
let current_room = house.rooms.get(house.current_room_id).unwrap();
|
let current_room = house.rooms.get(house.current_room_id).unwrap();
|
||||||
house.player.update(¤t_room.grid);
|
house.player.update(¤t_room.grid);
|
||||||
|
|
Loading…
Reference in a new issue