overworld human icon
Some checks failed
Rust / rustfmt (push) Successful in 26s
Rust / clippy (push) Failing after 1m32s
Rust / build (push) Successful in 3m14s

This commit is contained in:
Dominic 2024-07-07 17:39:06 +02:00
parent ac21220dea
commit 28655cc819
Signed by: msrd0
GPG key ID: AAF7C8430CA3345D
2 changed files with 25 additions and 5 deletions

View file

@ -4,15 +4,25 @@ use crate::{
State
};
use comfy::{
delta, draw_circle, draw_rect_outline, draw_sprite, error, info, is_key_down,
main_camera_mut, EngineContext, IVec2, KeyCode, Vec2, RED, WHITE
draw_circle, draw_rect_outline, draw_sprite, error, info, is_key_down,
main_camera_mut, texture_id, vec2, EngineContext, IVec2, KeyCode, Vec2, RED, WHITE
};
use std::time::Instant;
use worldgen::MovementCost;
pub mod worldgen;
pub fn draw(state: &crate::State, _engine: &comfy::EngineContext<'_>) {
pub fn setup(_state: &State, ctx: &EngineContext<'_>) {
ctx.load_texture_from_bytes(
"human_overworld",
include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/assets/entities/human_overworld.png"
))
);
}
pub fn draw(state: &State, _ctx: &EngineContext<'_>) {
for (coords, tile) in state.overworld.iter_tiles() {
for (i, texture) in tile.textures().iter().rev().enumerate() {
let i = i as i32;
@ -28,7 +38,16 @@ pub fn draw(state: &crate::State, _engine: &comfy::EngineContext<'_>) {
}
}
}
draw_circle(state.ghost.overworld_pos, 0.5, RED, ZLayer::Ghost.into());
let mut ghost_pos = state.ghost.overworld_pos;
ghost_pos.y += 0.5;
draw_sprite(
texture_id("human_overworld"),
ghost_pos,
WHITE,
ZLayer::Ghost.into(),
vec2(1.0, 1.25)
);
}
fn update_move_player(state: &mut State, _ctx: &mut EngineContext<'_>) {

View file

@ -101,9 +101,10 @@ impl Add<i32> for ZLayer {
}
}
pub fn setup(_state: &mut State, ctx: &mut EngineContext<'_>) {
pub fn setup(state: &mut State, ctx: &mut EngineContext<'_>) {
Assets::load(ctx);
overworld::setup(state, ctx);
//house::setup(state, ctx);
}