2015-03-25 01:38:53 -04:00
|
|
|
require "entity"
|
|
|
|
|
|
|
|
|
|
GenericMoveable = class("GenericMoveable", Entity)
|
|
|
|
|
|
2026-08-21 16:34:01 -04:00
|
|
|
function GenericMoveable:initialize(x, y, color, sprite, name, cellShape, adhesion)
|
2015-03-25 01:38:53 -04:00
|
|
|
Entity.initialize(self, {
|
2015-03-25 04:22:10 -04:00
|
|
|
name = name,
|
2015-03-25 01:38:53 -04:00
|
|
|
x = x,
|
|
|
|
|
y = y,
|
|
|
|
|
color = color,
|
|
|
|
|
collision = "moveable",
|
2026-08-11 12:42:33 -04:00
|
|
|
sprite = sprite,
|
2026-08-21 16:34:01 -04:00
|
|
|
cellShape = cellShape,
|
|
|
|
|
adhesion = adhesion
|
2015-03-25 01:38:53 -04:00
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function GenericMoveable:update()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
2026-08-21 16:34:01 -04:00
|
|
|
-- Adhesion drives the look as well as the mechanic: gluey blocks get spiked
|
|
|
|
|
-- teeth on their true contour, sticky blocks get the wobbling goopy shader, and
|
|
|
|
|
-- plain moveables draw normally.
|
|
|
|
|
function GenericMoveable:draw(channel)
|
|
|
|
|
local sprite = self.sprites[channel]
|
|
|
|
|
if not sprite then return end
|
|
|
|
|
love.graphics.setColor(gColor[channel]:set())
|
|
|
|
|
local p = self:getDrawPos()
|
|
|
|
|
local x = p.x + self.drawOffset.x * drawScale
|
|
|
|
|
local y = p.y + self.drawOffset.y * drawScale
|
|
|
|
|
if self.adhesion == "gluey" and drawGlueySprite then
|
|
|
|
|
drawGlueySprite(sprite, self:getCellShape(), x, y, drawScale)
|
|
|
|
|
elseif self.adhesion == "sticky" and drawGoopySprite then
|
|
|
|
|
drawGoopySprite(sprite, x, y, drawScale)
|
|
|
|
|
else
|
|
|
|
|
love.graphics.draw(sprite, x, y, 0, drawScale, drawScale)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2015-03-25 01:38:53 -04:00
|
|
|
function GenericMoveable:tick()
|
|
|
|
|
|
2026-08-21 16:34:01 -04:00
|
|
|
end
|