-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
damage numbers, hp & damage affected by stats
- Loading branch information
1 parent
0733a45
commit 47fc63a
Showing
10 changed files
with
83 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
damageText = { | ||
container = {} | ||
} | ||
|
||
function damageText.reset() | ||
damageText.container = {} | ||
end | ||
|
||
-- t = {v=_, x=_, y=_} | ||
function damageText.add(t) | ||
if t.v == nil then t.v = 0 end | ||
if t.x == nil then t.x = 0 end | ||
if t.y == nil then t.y = 0 end | ||
t.v = tostring(t.v) | ||
t.timer = 1 | ||
table.insert(damageText.container, t) | ||
end | ||
|
||
function damageText.update(dt) | ||
for k, v in pairs(damageText.container) do | ||
v.timer = v.timer - dt*0.5 | ||
if v.timer < 0 then | ||
damageText.container[k] = nil | ||
end | ||
end | ||
end | ||
|
||
function damageText.draw() | ||
local font = fonts.stats | ||
love.graphics.setFont(font) | ||
for _, v in pairs(damageText.container) do | ||
local t = ease.outCubic(1 - v.timer) | ||
local y = v.y - t*8 | ||
love.graphics.setColor(1, 0, 0, 1 - t) | ||
love.graphics.print(v.v, lume.round(v.x - font:getWidth(v.v)/2), lume.round(y - font:getHeight()/2)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters