A_RTS/scripts/units.lua

25 lines
432 B
Lua

Unit = {
class = "Unit",
faction = 0,
troops = {},
is_selected = false,
portrait = nil
}
function Unit:newUnit(name,faction,portrait,stat_table,banner_path)
o = {
-- ids
name = name,
faction = faction,
portrait = love.graphics.newImage(portrait)
}
setmetatable(o, self)
self.__index = self
return o
end
function addToUnit(u,t)
t.faction = u.faction
t.is_selected = t.is_selected
table.insert(u.troops,t)
end