mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 14:19:02 -06:00
Merge pull request #4 from Rexxt/master
Small updates to visuals and sound
This commit is contained in:
commit
49e52c6a39
@ -14,11 +14,17 @@ sounds = {
|
|||||||
cursor_lr = love.audio.newSource("res/se/cursor_lr.wav", "static"),
|
cursor_lr = love.audio.newSource("res/se/cursor_lr.wav", "static"),
|
||||||
main_decide = love.audio.newSource("res/se/main_decide.wav", "static"),
|
main_decide = love.audio.newSource("res/se/main_decide.wav", "static"),
|
||||||
mode_decide = love.audio.newSource("res/se/mode_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"),
|
||||||
|
go = love.audio.newSource("res/se/go.wav", "static"),
|
||||||
}
|
}
|
||||||
|
|
||||||
function playSE(sound, subsound)
|
function playSE(sound, subsound)
|
||||||
if subsound == nil then
|
if subsound == nil then
|
||||||
sounds[sound]:setVolume(0.1)
|
sounds[sound]:setVolume(0.5)
|
||||||
if sounds[sound]:isPlaying() then
|
if sounds[sound]:isPlaying() then
|
||||||
sounds[sound]:stop()
|
sounds[sound]:stop()
|
||||||
end
|
end
|
||||||
@ -31,3 +37,19 @@ function playSE(sound, subsound)
|
|||||||
sounds[sound][subsound]:play()
|
sounds[sound][subsound]:play()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function playSEOnce(sound, subsound)
|
||||||
|
if subsound == nil then
|
||||||
|
sounds[sound]:setVolume(0.5)
|
||||||
|
if sounds[sound]:isPlaying() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
sounds[sound]:play()
|
||||||
|
else
|
||||||
|
sounds[sound][subsound]:setVolume(0.5)
|
||||||
|
if sounds[sound][subsound]:isPlaying() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
sounds[sound][subsound]:play()
|
||||||
|
end
|
||||||
|
end
|
Binary file not shown.
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.3 MiB |
Binary file not shown.
BIN
res/se/erase.wav
Normal file
BIN
res/se/erase.wav
Normal file
Binary file not shown.
BIN
res/se/fall.wav
Normal file
BIN
res/se/fall.wav
Normal file
Binary file not shown.
BIN
res/se/go.wav
Normal file
BIN
res/se/go.wav
Normal file
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
Normal file
BIN
res/se/lock.wav
Normal file
Binary file not shown.
BIN
res/se/ready.wav
Normal file
BIN
res/se/ready.wav
Normal file
Binary file not shown.
@ -49,6 +49,7 @@ function GameScene:render()
|
|||||||
self.game:drawScoringInfo()
|
self.game:drawScoringInfo()
|
||||||
|
|
||||||
-- ready/go graphics
|
-- ready/go graphics
|
||||||
|
|
||||||
if self.game.ready_frames <= 100 and self.game.ready_frames > 52 then
|
if self.game.ready_frames <= 100 and self.game.ready_frames > 52 then
|
||||||
love.graphics.draw(misc_graphics["ready"], 144 - 50, 240 - 14)
|
love.graphics.draw(misc_graphics["ready"], 144 - 50, 240 - 14)
|
||||||
elseif self.game.ready_frames <= 50 and self.game.ready_frames > 2 then
|
elseif self.game.ready_frames <= 50 and self.game.ready_frames > 2 then
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
local Object = require 'libs.classic'
|
local Object = require 'libs.classic'
|
||||||
require 'funcs'
|
require 'funcs'
|
||||||
|
|
||||||
|
local playedReadySE = false
|
||||||
|
local playedGoSE = false
|
||||||
|
|
||||||
local Grid = require 'tetris.components.grid'
|
local Grid = require 'tetris.components.grid'
|
||||||
local Randomizer = require 'tetris.randomizers.randomizer'
|
local Randomizer = require 'tetris.randomizers.randomizer'
|
||||||
|
|
||||||
@ -161,6 +164,7 @@ function GameMode:update(inputs, ruleset)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if cleared_row_count > 0 then
|
if cleared_row_count > 0 then
|
||||||
|
playSE("erase")
|
||||||
self.lcd = self:getLineClearDelay()
|
self.lcd = self:getLineClearDelay()
|
||||||
self.are = self:getLineARE()
|
self.are = self:getLineARE()
|
||||||
if self.lcd == 0 then
|
if self.lcd == 0 then
|
||||||
@ -194,10 +198,16 @@ end
|
|||||||
|
|
||||||
-- event functions
|
-- event functions
|
||||||
function GameMode:whilePieceActive() end
|
function GameMode:whilePieceActive() end
|
||||||
function GameMode:onPieceLock(piece, cleared_row_count) end
|
function GameMode:onPieceLock(piece, cleared_row_count)
|
||||||
|
playSE("lock")
|
||||||
|
end
|
||||||
|
|
||||||
function GameMode:onLineClear(cleared_row_count) end
|
function GameMode:onLineClear(cleared_row_count) end
|
||||||
|
|
||||||
function GameMode:onPieceEnter() end
|
function GameMode:onPieceEnter() end
|
||||||
function GameMode:onHold() end
|
function GameMode:onHold()
|
||||||
|
playSE("hold")
|
||||||
|
end
|
||||||
|
|
||||||
function GameMode:onSoftDrop(dropped_row_count)
|
function GameMode:onSoftDrop(dropped_row_count)
|
||||||
self.drop_bonus = self.drop_bonus + 1 * dropped_row_count
|
self.drop_bonus = self.drop_bonus + 1 * dropped_row_count
|
||||||
@ -239,8 +249,20 @@ function GameMode:chargeDAS(inputs)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function GameMode:processDelays(inputs, ruleset, drop_speed)
|
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 self.ready_frames > 0 then
|
||||||
|
if not playedReadySE then
|
||||||
|
playedReadySE = true
|
||||||
|
playSEOnce("ready")
|
||||||
|
end
|
||||||
self.ready_frames = self.ready_frames - 1
|
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
|
if self.ready_frames == 0 then
|
||||||
self:initializeOrHold(inputs, ruleset)
|
self:initializeOrHold(inputs, ruleset)
|
||||||
end
|
end
|
||||||
@ -248,6 +270,7 @@ function GameMode:processDelays(inputs, ruleset, drop_speed)
|
|||||||
self.lcd = self.lcd - 1
|
self.lcd = self.lcd - 1
|
||||||
if self.lcd == 0 then
|
if self.lcd == 0 then
|
||||||
self.grid:clearClearedRows()
|
self.grid:clearClearedRows()
|
||||||
|
playSE("fall")
|
||||||
if self.are == 0 then
|
if self.are == 0 then
|
||||||
self:initializeOrHold(inputs, ruleset)
|
self:initializeOrHold(inputs, ruleset)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user