bytepath/obj/game/Player.lua

27 lines
641 B
Lua

---@class Player:GameObject
---@field area Area
---@field x number
---@field y number
---@field opts table|nil
local Player = GameObject:extend()
function Player:new(area, x, y, opts)
Player.super.new(self, area, x, y, opts)
self.w, self.h = 12, 12
self.collider = self.area.world:circle(self.x, self.y, math.floor(self.w*0.8))
end
function Player:update(dt)
Player.super.update(self, dt)
end
function Player:draw()
Player.super.draw(self)
love.graphics.setColor(1, 0.4, 0.4)
self.collider:draw()
love.graphics.setColor(1, 1, 1)
love.graphics.circle('line', self.x, self.y, self.w)
end
return Player