47 lines
911 B
Lua
47 lines
911 B
Lua
|
|
require "entity"
|
||
|
|
require "generic_skewer"
|
||
|
|
|
||
|
|
GenericSpiky = class("GenericSpiky", Entity)
|
||
|
|
|
||
|
|
function drawSpikySprite(sprite, _, x, y, scale)
|
||
|
|
if drawGoopySprite then
|
||
|
|
drawGoopySprite(sprite, x, y, scale)
|
||
|
|
else
|
||
|
|
love.graphics.draw(sprite, x, y, 0, scale, scale)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
function GenericSpiky:initialize(x, y, color, sprite, name, cellShape)
|
||
|
|
Entity.initialize(self, {
|
||
|
|
name = name,
|
||
|
|
x = x,
|
||
|
|
y = y,
|
||
|
|
color = color,
|
||
|
|
collision = "moveable",
|
||
|
|
spiky = true,
|
||
|
|
sprite = sprite,
|
||
|
|
cellShape = cellShape
|
||
|
|
})
|
||
|
|
end
|
||
|
|
|
||
|
|
function GenericSpiky:update()
|
||
|
|
|
||
|
|
end
|
||
|
|
|
||
|
|
function GenericSpiky:draw(channel)
|
||
|
|
local sprite = self.sprites[channel]
|
||
|
|
if not sprite then return end
|
||
|
|
love.graphics.setColor(gColor[channel]:set())
|
||
|
|
local p = self:getDrawPos()
|
||
|
|
drawSpikySprite(
|
||
|
|
sprite, self:getCellShape(),
|
||
|
|
p.x + self.drawOffset.x * drawScale,
|
||
|
|
p.y + self.drawOffset.y * drawScale,
|
||
|
|
drawScale
|
||
|
|
)
|
||
|
|
end
|
||
|
|
|
||
|
|
function GenericSpiky:tick()
|
||
|
|
|
||
|
|
end
|