inventory finishes
This commit is contained in:
parent
aadb966fa4
commit
f26adf352e
6 changed files with 126 additions and 5 deletions
|
|
@ -8,7 +8,12 @@ use specs::prelude::*;
|
|||
pub fn player(ecs: &mut World, player_x: i32, player_y: i32) -> Entity {
|
||||
ecs.create_entity()
|
||||
.with(Position { x: player_x, y: player_y })
|
||||
.with(Renderable { glyph: rltk::to_cp437('@'), fg: RGB::named(rltk::YELLOW), bg: RGB::named(rltk::BLACK) })
|
||||
.with(Renderable {
|
||||
glyph: rltk::to_cp437('@'),
|
||||
fg: RGB::named(rltk::YELLOW),
|
||||
bg: RGB::named(rltk::BLACK),
|
||||
render_order: 0,
|
||||
})
|
||||
.with(Player {})
|
||||
.with(Viewshed { visible_tiles: Vec::new(), range: 8, dirty: true })
|
||||
.with(Name { name: "hero (you)".to_string() })
|
||||
|
|
@ -35,7 +40,7 @@ const MAX_ITEMS: i32 = 2;
|
|||
fn monster<S: ToString>(ecs: &mut World, x: i32, y: i32, glyph: rltk::FontCharType, name: S) {
|
||||
ecs.create_entity()
|
||||
.with(Position { x, y })
|
||||
.with(Renderable { glyph: glyph, fg: RGB::named(rltk::RED), bg: RGB::named(rltk::BLACK) })
|
||||
.with(Renderable { glyph: glyph, fg: RGB::named(rltk::RED), bg: RGB::named(rltk::BLACK), render_order: 1 })
|
||||
.with(Viewshed { visible_tiles: Vec::new(), range: 8, dirty: true })
|
||||
.with(Monster {})
|
||||
.with(Name { name: name.to_string() })
|
||||
|
|
@ -105,7 +110,12 @@ pub fn spawn_room(ecs: &mut World, room: &Rect) {
|
|||
fn health_potion(ecs: &mut World, x: i32, y: i32) {
|
||||
ecs.create_entity()
|
||||
.with(Position { x, y })
|
||||
.with(Renderable { glyph: rltk::to_cp437('i'), fg: RGB::named(rltk::MAGENTA), bg: RGB::named(rltk::BLACK) })
|
||||
.with(Renderable {
|
||||
glyph: rltk::to_cp437('i'),
|
||||
fg: RGB::named(rltk::MAGENTA),
|
||||
bg: RGB::named(rltk::BLACK),
|
||||
render_order: 2,
|
||||
})
|
||||
.with(Name { name: "health potion".to_string() })
|
||||
.with(Item {})
|
||||
.with(Potion { heal_amount: 8 })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue