overworld human icon
This commit is contained in:
parent
ac21220dea
commit
28655cc819
2 changed files with 25 additions and 5 deletions
|
@ -4,15 +4,25 @@ use crate::{
|
||||||
State
|
State
|
||||||
};
|
};
|
||||||
use comfy::{
|
use comfy::{
|
||||||
delta, draw_circle, draw_rect_outline, draw_sprite, error, info, is_key_down,
|
draw_circle, draw_rect_outline, draw_sprite, error, info, is_key_down,
|
||||||
main_camera_mut, EngineContext, IVec2, KeyCode, Vec2, RED, WHITE
|
main_camera_mut, texture_id, vec2, EngineContext, IVec2, KeyCode, Vec2, RED, WHITE
|
||||||
};
|
};
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use worldgen::MovementCost;
|
use worldgen::MovementCost;
|
||||||
|
|
||||||
pub mod worldgen;
|
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 (coords, tile) in state.overworld.iter_tiles() {
|
||||||
for (i, texture) in tile.textures().iter().rev().enumerate() {
|
for (i, texture) in tile.textures().iter().rev().enumerate() {
|
||||||
let i = i as i32;
|
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<'_>) {
|
fn update_move_player(state: &mut State, _ctx: &mut EngineContext<'_>) {
|
||||||
|
|
|
@ -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);
|
Assets::load(ctx);
|
||||||
|
|
||||||
|
overworld::setup(state, ctx);
|
||||||
//house::setup(state, ctx);
|
//house::setup(state, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue