Replace box variants with a moveable adhesion property
Collapse the spiky/sticky/skewer box-variant assets into a single per-
instance `adhesion` property on any moveable block, chosen in the editor
via a dropdown next to the colour picker and stored in the .sav alongside
the class.
- spiky -> sticky: soft grab on every true edge (goopy shader)
- skewer -> gluey: rigid weld on every true edge (spiked outline)
- old trailing-face sticky is removed; its saves fold into new sticky
Move the spike geometry + drawGlueySprite into shaders.lua, fold drawing
and the adhesion flag into GenericMoveable, and delete the three
Generic{Sticky,Spiky,Skewer} classes and box_variants.lua. Room:createEntity
normalises legacy spiky_/skewer_/sticky_ class prefixes so old saves load,
and serialization emits `adhesion`. World/map previews and the movement
proxy follow the rename.
Backfill rooms/*.sav to the new format via tools/backfill_adhesion.lua
(41 objects across 8 files). Update tests to the two-mode model; the two
tests asserting the removed lateral-shear limitation are dropped and a
legacy-load migration test added. 27/27 pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
c348b81a93
commit
7d84f595e4
25 changed files with 4010 additions and 3797 deletions
|
|
@ -2,7 +2,7 @@ require "entity"
|
|||
|
||||
GenericMoveable = class("GenericMoveable", Entity)
|
||||
|
||||
function GenericMoveable:initialize(x, y, color, sprite, name, cellShape)
|
||||
function GenericMoveable:initialize(x, y, color, sprite, name, cellShape, adhesion)
|
||||
Entity.initialize(self, {
|
||||
name = name,
|
||||
x = x,
|
||||
|
|
@ -10,7 +10,8 @@ function GenericMoveable:initialize(x, y, color, sprite, name, cellShape)
|
|||
color = color,
|
||||
collision = "moveable",
|
||||
sprite = sprite,
|
||||
cellShape = cellShape
|
||||
cellShape = cellShape,
|
||||
adhesion = adhesion
|
||||
})
|
||||
end
|
||||
|
||||
|
|
@ -18,6 +19,25 @@ 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
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue