add and draw collision to player
This commit is contained in:
parent
fd69762121
commit
c225cc6edf
1 changed files with 7 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue