diff options
| author | troido <troido@protonmail.com> | 2020-02-22 23:41:51 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-22 23:41:51 +0100 |
| commit | 522aad7889cd62e96af7c420789507ccbf5b7aaa (patch) | |
| tree | bfb3c21d627552bcda6f2743854cee920722fd3b /src/components/mod.rs | |
| parent | f4331041e5d906f95063f317852f32f19e6cdf9c (diff) | |
it is now possible to use items
Diffstat (limited to 'src/components/mod.rs')
| -rw-r--r-- | src/components/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/components/mod.rs b/src/components/mod.rs index a0ccde4..459590b 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -84,6 +84,14 @@ pub struct Health { pub health: i64, pub maxhealth: i64 } +impl Health { + pub fn heal(&mut self, amount: i64) { + self.health += amount; + if self.health > self.maxhealth { + self.health = self.maxhealth; + } + } +} #[derive(Component, Debug, Clone)] pub struct Serialise { |
