atlantis/enemies/urchin.lua

31 lines
583 B
Lua

local physics = require("physics")
local urchin = {
}
function urchin.new(x, y)
return {
x = x,
y = y,
width = 12,
height = 12,
update = urchin.update,
draw = urchin.draw,
sprite = love.graphics.newImage("sprites/urchin.png"),
value = 1,
}
end
function urchin.update(self, player, level, dt)
if physics.boxCollide(self, player) then
player:hurt(1)
end
end
function urchin.draw(self)
love.graphics.setColor(1, 1, 1)
love.graphics.draw(self.sprite, self.x, self.y);
end
return urchin