2021-03-20 10:17:05 +00:00
|
|
|
-------- combat --------
|
|
|
|
function draw_combat_ui()
|
|
|
|
local unit_count = 0
|
|
|
|
-- count how much units
|
|
|
|
for _, unit in pairs(current_level.units) do
|
|
|
|
if unit.faction == player.id then
|
|
|
|
unit_count = unit_count + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local unit_total = unit_count
|
|
|
|
-- position units accordingly
|
|
|
|
unit_count = 0
|
|
|
|
for _, unit in pairs(current_level.units) do
|
|
|
|
unit_count = unit_count + 1
|
|
|
|
if unit.faction == player.id then
|
|
|
|
draw_portrait(unit,unit_count,unit_total)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function draw_portrait(u,uc,ut)
|
|
|
|
--$-- temporal
|
2021-03-20 11:01:09 +00:00
|
|
|
--love.graphics.line(game_width/2,0,game_width/2,game_height)
|
2021-03-20 10:17:05 +00:00
|
|
|
--$--
|
|
|
|
local pos_x = (game_width/2)+((72)*ut)/2-(72)*uc
|
|
|
|
local pos_y = (game_height-86)
|
|
|
|
|
2021-03-22 17:14:10 +00:00
|
|
|
love.graphics.draw(img.hud.unit_portrait, pos_x-2, pos_y, 0, 1)
|
|
|
|
love.graphics.draw(u.portrait, pos_x, pos_y+18 , 0, 4)
|
2021-03-20 10:17:05 +00:00
|
|
|
end
|
|
|
|
-------- combat --------
|