31 lines
854 B
Lua
31 lines
854 B
Lua
-------- 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
|
|
--love.graphics.line(game_width/2,0,game_width/2,game_height)
|
|
--$--
|
|
local pos_x = (game_width/2)+((72)*ut)/2-(72)*uc
|
|
local pos_y = (game_height-86)
|
|
|
|
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)
|
|
end
|
|
-------- combat -------- |