Add classes

This commit is contained in:
rubenwardy 2019-03-21 01:36:59 +00:00
parent bc9967907e
commit 34d891c6c5
18 changed files with 257 additions and 6 deletions

View file

@ -33,8 +33,8 @@ function hp_bar:on_step(dtime)
return
end
local hp = wielder:get_hp()
local breath = wielder:get_breath()
local hp = math.floor(20 * wielder:get_hp() / wielder:get_properties().hp_max)
local breath = math.floor(20 * wielder:get_breath() / wielder:get_properties().breath_max)
self.object:set_properties({
textures = {
"health_" .. tostring(hp) .. ".png^breath_" .. tostring(breath) .. ".png",

View file

@ -12,8 +12,8 @@ local function regen_all()
local oldhp = player:get_hp()
if oldhp > 0 then
local newhp = oldhp + regen_amount
if newhp > 20 then
newhp = 20
if newhp > player:get_properties().hp_max then
newhp = player:get_properties().hp_max
end
player:set_hp(newhp)
end