From f7d21428fff6bddb591e0e24f16c892576fb8a50 Mon Sep 17 00:00:00 2001 From: Glaeder Date: Sun, 7 Jul 2024 18:19:49 +0200 Subject: [PATCH] Added human texture to house --- src/activities/house/room.rs | 6 ++++-- src/game.rs | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/activities/house/room.rs b/src/activities/house/room.rs index fd14e5f..4962574 100644 --- a/src/activities/house/room.rs +++ b/src/activities/house/room.rs @@ -1,7 +1,7 @@ use super::{furniture::Furniture, grid::Grid}; use crate::game::{self, ZLayer}; use comfy::{ - draw_circle, draw_rect, draw_rect_outline, draw_sprite, error, random_i32, vec2, EngineContext, HashSet, RandomRange as _, Vec2, GOLD, GREEN, PURPLE, RED, WHITE + draw_circle, draw_rect, draw_rect_outline, draw_sprite, error, random_i32, texture_id, vec2, EngineContext, HashSet, RandomRange as _, Vec2, GOLD, GREEN, PURPLE, RED, WHITE }; use indexmap::IndexSet; @@ -465,10 +465,12 @@ impl Room { } } + if human_layer { if let Some(human_pos) = self.human_pos { //draw_circle(human_pos, 0.5, RED, 20); - draw_rect(human_pos , vec2(1.0, 2.0) * SCALE, GOLD, ZLayer::Human.into()); + draw_sprite(texture_id("human_house"), human_pos, WHITE, ZLayer::Human.into(), vec2(1.0, 2.0) * SCALE); } + } /* Debug draw diff --git a/src/game.rs b/src/game.rs index 5674bcd..6352858 100644 --- a/src/game.rs +++ b/src/game.rs @@ -114,6 +114,14 @@ pub fn setup(state: &mut State, ctx: &mut EngineContext<'_>) { "/assets/entities/ghost.png" )) ); + + ctx.load_texture_from_bytes( + "human_house", + include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/assets/entities/human_captured.png" + )) + ); } /// The amount of energy a ghost consumes idle.