require "entity" GenericMoveable = class("GenericMoveable", Entity) function GenericMoveable:initialize(x, y, color, sprite, name, cellShape, adhesion) Entity.initialize(self, { name = name, x = x, y = y, color = color, collision = "moveable", sprite = sprite, cellShape = cellShape, adhesion = adhesion }) end function GenericMoveable:update() end -- 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 function GenericMoveable:tick() end