diff options
| author | cursed22bc <admin@pixeldawn.org> | 2026-03-11 12:50:56 +0200 |
|---|---|---|
| committer | cursed22bc <admin@pixeldawn.org> | 2026-03-11 12:50:56 +0200 |
| commit | 8c5a91acb224312ea511c7ff502c44bb9fe7452b (patch) | |
| tree | 194a2aee7f92fabbab79cc0ab64f0d2989b7d55e /world.lua | |
| parent | cd432860828a84aca93852a09cf05fc0e6294bab (diff) | |
sfx and other polish
Diffstat (limited to 'world.lua')
| -rw-r--r-- | world.lua | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -6,6 +6,7 @@ local Textbox = require("textbox") local Enemy = require("enemy") local BloodParticle = require("bloodParticle") local DustSystem = require("dustParticle") +local sfx = require("sfx") local World = {} World.__index = World @@ -236,6 +237,7 @@ end function World:handlePickup(pickup, player) if pickup and player and pickup.isPickup and self:_isPlayerLike(player) then + if not pickup.collected then sfx.play("pickup") end pickup:pickup(self, player) end end @@ -250,7 +252,7 @@ function World:handleDoor(door, player) if keyCount >= needed then self.doorOpened = true self.playerTextbox:show( - "The door opens! You escaped!", + "Bye Bye!", { player.x + player.width / 2, player.y - 20, "center" }, "write", { life = 5, fontSize = 9, centeredText = true, wrapToFit = true } @@ -321,11 +323,15 @@ function World:_onBeginContact(udA, udB, nx, ny, contact) end if type(udA) == "table" and udA.type == "water" and self:_isTrackedEntity(udB) then + local wasInWater = (self.waterContacts[udB] or 0) > 0 self.waterContacts[udB] = (self.waterContacts[udB] or 0) + 1 doWaterSplash(udA, udB) + if not wasInWater and self:_isPlayerLike(udB) then sfx.play("dive") end elseif type(udB) == "table" and udB.type == "water" and self:_isTrackedEntity(udA) then + local wasInWater = (self.waterContacts[udA] or 0) > 0 self.waterContacts[udA] = (self.waterContacts[udA] or 0) + 1 doWaterSplash(udB, udA) + if not wasInWater and self:_isPlayerLike(udA) then sfx.play("dive") end end local playerEntity, hazardNx, hazardNy |
