bytepath/obj/GameObject.lua

31 lines
635 B
Lua

---@module 'obj/GameObject'
---@class GameObject:Object
---@field area number
---@field x number
---@field y number
---@field opts table|nil
local GameObject = Object:extend()
---Instantiates game object
function GameObject:new(area, x, y, opts)
if opts then for k,v in pairs(opts) do self[k] = v end end
self.area = area
self.x = x
self.y = y
self.id = UUID()
self.dead = false
self.timer = Timer()
end
---Updates game object
---@param dt number
function GameObject:update(dt)
if self.timer then self.timer:update(dt) end
end
---Draw game object
function GameObject:draw() end
return GameObject