mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 03:29:02 -06:00
Replace SFX and add hold
This commit is contained in:
parent
d38168ca00
commit
a324e0015a
@ -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
|
||||
|
Binary file not shown.
BIN
res/se/erase.wav
BIN
res/se/erase.wav
Binary file not shown.
BIN
res/se/fall.wav
BIN
res/se/fall.wav
Binary file not shown.
BIN
res/se/go.wav
BIN
res/se/go.wav
Binary file not shown.
BIN
res/se/hold.wav
Normal file
BIN
res/se/hold.wav
Normal file
Binary file not shown.
BIN
res/se/lock.wav
BIN
res/se/lock.wav
Binary file not shown.
BIN
res/se/ready.wav
BIN
res/se/ready.wav
Binary file not shown.
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user