From 8c5a91acb224312ea511c7ff502c44bb9fe7452b Mon Sep 17 00:00:00 2001 From: cursed22bc Date: Wed, 11 Mar 2026 12:50:56 +0200 Subject: sfx and other polish --- world.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'world.lua') diff --git a/world.lua b/world.lua index ff7a1ad..58dae39 100644 --- a/world.lua +++ b/world.lua @@ -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 -- cgit v1.2.3