Add Health component and HUD system
This commit is contained in:
parent
8d595d8508
commit
b4796f40ea
@ -20,3 +20,9 @@ pub struct WantsToMove {
|
|||||||
pub entity: Entity,
|
pub entity: Entity,
|
||||||
pub destination: Point,
|
pub destination: Point,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
|
pub struct Health {
|
||||||
|
pub current: i32,
|
||||||
|
pub max: i32,
|
||||||
|
}
|
||||||
|
@ -70,6 +70,8 @@ impl GameState for State {
|
|||||||
ctx.cls();
|
ctx.cls();
|
||||||
ctx.set_active_console(1);
|
ctx.set_active_console(1);
|
||||||
ctx.cls();
|
ctx.cls();
|
||||||
|
ctx.set_active_console(2);
|
||||||
|
ctx.cls();
|
||||||
|
|
||||||
self.resources.insert(ctx.key);
|
self.resources.insert(ctx.key);
|
||||||
|
|
||||||
@ -99,8 +101,10 @@ fn main() -> BError {
|
|||||||
.with_tile_dimensions(32, 32)
|
.with_tile_dimensions(32, 32)
|
||||||
.with_resource_path("resources/")
|
.with_resource_path("resources/")
|
||||||
.with_font("dungeonfont.png", 32, 32)
|
.with_font("dungeonfont.png", 32, 32)
|
||||||
|
.with_font("terminal8x8.png", 8, 8)
|
||||||
.with_simple_console(DISPLAY_WIDTH, DISPLAY_HEIGHT, "dungeonfont.png")
|
.with_simple_console(DISPLAY_WIDTH, DISPLAY_HEIGHT, "dungeonfont.png")
|
||||||
.with_simple_console_no_bg(DISPLAY_WIDTH, DISPLAY_HEIGHT, "dungeonfont.png")
|
.with_simple_console_no_bg(DISPLAY_WIDTH, DISPLAY_HEIGHT, "dungeonfont.png")
|
||||||
|
.with_simple_console_no_bg(SCREEN_WIDTH * 2, SCREEN_HEIGHT * 2, "terminal8x8.png")
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
main_loop(context, State::new())
|
main_loop(context, State::new())
|
||||||
|
@ -8,6 +8,10 @@ pub fn spawn_player(ecs: &mut World, pos: Point) {
|
|||||||
color: ColorPair::new(WHITE, BLACK),
|
color: ColorPair::new(WHITE, BLACK),
|
||||||
glyph: to_cp437('@'),
|
glyph: to_cp437('@'),
|
||||||
},
|
},
|
||||||
|
Health {
|
||||||
|
current: 20,
|
||||||
|
max: 20,
|
||||||
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
mod collisions;
|
mod collisions;
|
||||||
mod end_turn;
|
mod end_turn;
|
||||||
mod entity_render;
|
mod entity_render;
|
||||||
|
mod hud;
|
||||||
mod map_render;
|
mod map_render;
|
||||||
mod movement;
|
mod movement;
|
||||||
mod player_input;
|
mod player_input;
|
||||||
@ -14,6 +15,7 @@ pub fn build_input_scheduler() -> Schedule {
|
|||||||
.flush()
|
.flush()
|
||||||
.add_system(map_render::map_render_system())
|
.add_system(map_render::map_render_system())
|
||||||
.add_system(entity_render::entity_render_system())
|
.add_system(entity_render::entity_render_system())
|
||||||
|
.add_system(hud::hud_system())
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,6 +27,7 @@ pub fn build_player_scheduler() -> Schedule {
|
|||||||
.flush()
|
.flush()
|
||||||
.add_system(map_render::map_render_system())
|
.add_system(map_render::map_render_system())
|
||||||
.add_system(entity_render::entity_render_system())
|
.add_system(entity_render::entity_render_system())
|
||||||
|
.add_system(hud::hud_system())
|
||||||
.add_system(end_turn::end_turn_system())
|
.add_system(end_turn::end_turn_system())
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
@ -37,6 +40,7 @@ pub fn build_monster_scheduler() -> Schedule {
|
|||||||
.flush()
|
.flush()
|
||||||
.add_system(map_render::map_render_system())
|
.add_system(map_render::map_render_system())
|
||||||
.add_system(entity_render::entity_render_system())
|
.add_system(entity_render::entity_render_system())
|
||||||
|
.add_system(hud::hud_system())
|
||||||
.add_system(end_turn::end_turn_system())
|
.add_system(end_turn::end_turn_system())
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user