Skip to content

Commit

Permalink
broken type sort removed
Browse files Browse the repository at this point in the history
  • Loading branch information
parameterized committed Sep 22, 2018
1 parent 96884ae commit d6804de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
6 changes: 2 additions & 4 deletions entities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,14 @@ function entities.client.draw()
draw = function()
v:drawBody()
end,
y = v.y,
type = 'entityBody'
y = v.y
}
if v.drawHP then
scene.add{
draw = function()
v:drawHP()
end,
y = v.y,
type = 'entityHP'
y = v.y
}
end
end
Expand Down
4 changes: 2 additions & 2 deletions hud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function hud.draw()
local font = fonts.c17
love.graphics.setFont(font)
local level = tostring(math.floor(l))
love.graphics.print(level, lume.round(240 - font:getWidth(level)/2), lume.round(y))
text.print(level, lume.round(240 - font:getWidth(level)/2), lume.round(y))

font = fonts.stats
love.graphics.setFont(font)
Expand All @@ -225,7 +225,7 @@ function hud.draw()
sx = x + (sx - hud.statsPanel.openPos.x)
sy = y + (sy - hud.statsPanel.openPos.y)
local txt = tostring(player.stats[col][row])
love.graphics.print(txt, lume.round(sx - font:getWidth(txt)/2), lume.round(sy - font:getHeight()/2))
text.print(txt, lume.round(sx - font:getWidth(txt)/2), lume.round(sy - font:getHeight()/2))
end
end

Expand Down
12 changes: 2 additions & 10 deletions scene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function scene.reset()
scene.layers = {}
end

-- t = {draw=_, y=_, layer=_, type=_}
-- t = {draw=_, y=_, layer=_}
function scene.add(t)
if t.layer == nil then t.layer = 1 end
if scene.layers[t.layer] == nil then scene.layers[t.layer] = {} end
Expand All @@ -23,15 +23,7 @@ function scene.draw()
end
layers = isort(layers, 'k')
for _, layer in ipairs(layers) do
local sorted = isort(layer.v, function(a, b)
if a.type == 'entityBody' and b.type == 'entityHP' then
return true
elseif a.type == 'entityHP' and b.type == 'entityBody' then
return false
else
return a.y < b.y
end
end)
local sorted = isort(layer.v, 'y')
for _, v in pairs(sorted) do
v.draw()
end
Expand Down

0 comments on commit d6804de

Please sign in to comment.