From 86cdc6c567d0ca429d69bebbb2fb02f1d3754c8d Mon Sep 17 00:00:00 2001 From: troido Date: Sun, 23 Feb 2020 23:44:50 +0100 Subject: players can now attack other objects --- src/playerstate.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/playerstate.rs') diff --git a/src/playerstate.rs b/src/playerstate.rs index 6e41623..3339dd1 100644 --- a/src/playerstate.rs +++ b/src/playerstate.rs @@ -6,7 +6,8 @@ use crate::{ componentwrapper::{ComponentWrapper, PreEntity}, PlayerId, RoomId, - components::{Visible, Player, Inventory, Health}, + components::{Visible, Player, Inventory, Health, Fighter}, + attack::Attack, Result, aerr, Sprite, @@ -100,7 +101,7 @@ impl PlayerState { pub fn construct(&self, encyclopedia: &Encyclopedia) -> PreEntity { vec![ - ComponentWrapper::Visible(Visible{sprite: Sprite{name: "player".to_string()}, height: 1.0, name: self.id.name.clone()}), + ComponentWrapper::Visible(Visible{sprite: Sprite{name: "player".to_string()}, height: 1.2, name: self.id.name.clone()}), ComponentWrapper::Player(Player::new(self.id.clone())), ComponentWrapper::Inventory(Inventory{ items: self.inventory.iter().map( |template| { @@ -114,7 +115,8 @@ impl PlayerState { }).collect(), capacity: self.inventory_capacity }), - ComponentWrapper::Health(Health{health: self.health, maxhealth: self.maximum_health}) + ComponentWrapper::Health(Health{health: self.health, maxhealth: self.maximum_health}), + ComponentWrapper::Fighter(Fighter{attack: Attack::new(5)}) ] } } -- cgit