diff --git a/load/sounds.lua b/load/sounds.lua index 6a4877c..7a4d520 100644 --- a/load/sounds.lua +++ b/load/sounds.lua @@ -15,6 +15,7 @@ sounds = { main_decide = love.audio.newSource("res/se/main_decide.wav", "static"), mode_decide = love.audio.newSource("res/se/mode_decide.wav", "static"), lock = love.audio.newSource("res/se/lock.wav", "static"), + hold = love.audio.newSource("res/se/hold.wav", "static"), erase = love.audio.newSource("res/se/erase.wav", "static"), fall = love.audio.newSource("res/se/fall.wav", "static"), ready = love.audio.newSource("res/se/ready.wav", "static"), @@ -23,7 +24,7 @@ sounds = { function playSE(sound, subsound) if subsound == nil then - sounds[sound]:setVolume(0.1) + sounds[sound]:setVolume(0.5) if sounds[sound]:isPlaying() then sounds[sound]:stop() end @@ -39,13 +40,13 @@ end function playSEOnce(sound, subsound) if subsound == nil then - sounds[sound]:setVolume(0.1) + sounds[sound]:setVolume(0.5) if sounds[sound]:isPlaying() then return end sounds[sound]:play() else - sounds[sound][subsound]:setVolume(0.1) + sounds[sound][subsound]:setVolume(0.5) if sounds[sound][subsound]:isPlaying() then return end diff --git a/res/se/bottom.wav b/res/se/bottom.wav index 7fc6671..1a66150 100644 Binary files a/res/se/bottom.wav and b/res/se/bottom.wav differ diff --git a/res/se/erase.wav b/res/se/erase.wav index 76dbf99..ca326cf 100644 Binary files a/res/se/erase.wav and b/res/se/erase.wav differ diff --git a/res/se/fall.wav b/res/se/fall.wav index 01f5060..6e8dab1 100644 Binary files a/res/se/fall.wav and b/res/se/fall.wav differ diff --git a/res/se/go.wav b/res/se/go.wav index 2fb52ff..6f76435 100644 Binary files a/res/se/go.wav and b/res/se/go.wav differ diff --git a/res/se/hold.wav b/res/se/hold.wav new file mode 100644 index 0000000..b47072e Binary files /dev/null and b/res/se/hold.wav differ diff --git a/res/se/lock.wav b/res/se/lock.wav index d89ec56..d3538c1 100644 Binary files a/res/se/lock.wav and b/res/se/lock.wav differ diff --git a/res/se/ready.wav b/res/se/ready.wav index 21325d0..e9f8438 100644 Binary files a/res/se/ready.wav and b/res/se/ready.wav differ diff --git a/scene/game.lua b/scene/game.lua index 18b8504..c0a1d1f 100644 --- a/scene/game.lua +++ b/scene/game.lua @@ -49,12 +49,11 @@ function GameScene:render() self.game:drawScoringInfo() -- ready/go graphics + if self.game.ready_frames <= 100 and self.game.ready_frames > 52 then love.graphics.draw(misc_graphics["ready"], 144 - 50, 240 - 14) - playSEOnce("ready") elseif self.game.ready_frames <= 50 and self.game.ready_frames > 2 then love.graphics.draw(misc_graphics["go"], 144 - 27, 240 - 14) - playSEOnce("go") end self.game:drawCustom() diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 31c77fd..f5ce7c8 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -1,6 +1,9 @@ local Object = require 'libs.classic' require 'funcs' +local playedReadySE = false +local playedGoSE = false + local Grid = require 'tetris.components.grid' local Randomizer = require 'tetris.randomizers.randomizer' @@ -202,7 +205,9 @@ end function GameMode:onLineClear(cleared_row_count) end function GameMode:onPieceEnter() end -function GameMode:onHold() end +function GameMode:onHold() + playSE("hold") +end function GameMode:onSoftDrop(dropped_row_count) self.drop_bonus = self.drop_bonus + 1 * dropped_row_count @@ -244,8 +249,20 @@ function GameMode:chargeDAS(inputs) end function GameMode:processDelays(inputs, ruleset, drop_speed) + if self.ready_frames == 100 then + playedReadySE = false + playedGoSE = false + end if self.ready_frames > 0 then + if not playedReadySE then + playedReadySE = true + playSEOnce("ready") + end self.ready_frames = self.ready_frames - 1 + if self.ready_frames == 50 and not playedGoSE then + playedGoSE = true + playSEOnce("go") + end if self.ready_frames == 0 then self:initializeOrHold(inputs, ruleset) end