A_RTS/scripts/units.lua

25 lines
432 B
Lua
Raw Permalink Normal View History

2021-03-19 18:58:05 +00:00
Unit = {
class = "Unit",
faction = 0,
troops = {},
is_selected = false,
portrait = nil
2021-03-19 18:58:05 +00:00
}
function Unit:newUnit(name,faction,portrait,stat_table,banner_path)
2021-03-19 18:58:05 +00:00
o = {
-- ids
name = name,
faction = faction,
portrait = love.graphics.newImage(portrait)
2021-03-19 18:58:05 +00:00
}
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)
2021-03-19 18:58:05 +00:00
end