add and draw collision to player

This commit is contained in:
yuki 2025-11-11 03:22:44 -03:00
parent fd69762121
commit c225cc6edf

View file

@ -7,6 +7,9 @@ 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)
@ -15,6 +18,10 @@ 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