better shake

This commit is contained in:
Your Name 2026-08-07 10:27:56 -04:00
parent 0f79fe99ae
commit 12c37b5fa9
3 changed files with 37 additions and 16 deletions

View file

@ -21,8 +21,10 @@ function Entity:initialize(t)
self.drawOffset = {x = 0, y = 0}
if self.size.w < 1 or self.size.h < 1 then
self.drawOffset.x = (drawScale * 16 * self.size.w) / 2
self.drawOffset.y = (drawScale * 16 * self.size.h) / 2
-- Small sprites (notably 10px switches) are drawn inside a 16px cell.
-- Offset by the leftover space, not by half their own size.
self.drawOffset.x = drawScale * (16 - self.spriteSize.w) / 2
self.drawOffset.y = drawScale * (16 - self.spriteSize.h) / 2
end
end
@ -157,7 +159,7 @@ function Entity:setSprite(sprite)
end
function Entity:sha()
return math.random(-worldSha, worldSha) * .5
return math.random(-worldSha, worldSha) * .125 * drawScale
end
function Entity:bump()