Add spiky box variants
This commit is contained in:
parent
761214fe3e
commit
c3a2692351
10 changed files with 340 additions and 19 deletions
46
generic_spiky.lua
Normal file
46
generic_spiky.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue