mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-23 19:49:02 -06:00
Pitching BGM added and implemented in replays
This commit is contained in:
parent
cd90405865
commit
a79552a6f3
@ -6,6 +6,7 @@ bgm = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local current_bgm = nil
|
local current_bgm = nil
|
||||||
|
local pitch = 1
|
||||||
local bgm_locked = false
|
local bgm_locked = false
|
||||||
|
|
||||||
function switchBGM(sound, subsound)
|
function switchBGM(sound, subsound)
|
||||||
@ -84,5 +85,13 @@ end
|
|||||||
function resumeBGM()
|
function resumeBGM()
|
||||||
if current_bgm ~= nil then
|
if current_bgm ~= nil then
|
||||||
current_bgm:play()
|
current_bgm:play()
|
||||||
|
current_bgm:setPitch(pitch)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function pitchBGM(new_pitch)
|
||||||
|
pitch = new_pitch
|
||||||
|
if current_bgm ~= nil then
|
||||||
|
current_bgm:setPitch(pitch)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -81,6 +81,7 @@ function GameScene:onInputPress(e)
|
|||||||
scene = e.input == "retry" and GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs) or ModeSelectScene()
|
scene = e.input == "retry" and GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs) or ModeSelectScene()
|
||||||
elseif e.input == "retry" then
|
elseif e.input == "retry" then
|
||||||
switchBGM(nil)
|
switchBGM(nil)
|
||||||
|
pitchBGM(1)
|
||||||
self.game:onExit()
|
self.game:onExit()
|
||||||
scene = GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs)
|
scene = GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs)
|
||||||
elseif e.input == "pause" and not (self.game.game_over or self.game.completed) then
|
elseif e.input == "pause" and not (self.game.game_over or self.game.completed) then
|
||||||
|
@ -107,6 +107,8 @@ function ReplayScene:onInputPress(e)
|
|||||||
e.input == "menu_decide" or
|
e.input == "menu_decide" or
|
||||||
e.input == "retry"
|
e.input == "retry"
|
||||||
) then
|
) then
|
||||||
|
switchBGM(nil)
|
||||||
|
pitchBGM(1)
|
||||||
self.game:onExit()
|
self.game:onExit()
|
||||||
loadSave()
|
loadSave()
|
||||||
love.math.setRandomSeed(os.time())
|
love.math.setRandomSeed(os.time())
|
||||||
@ -126,11 +128,13 @@ function ReplayScene:onInputPress(e)
|
|||||||
if self.replay_speed < 1 then
|
if self.replay_speed < 1 then
|
||||||
self.replay_speed = 1
|
self.replay_speed = 1
|
||||||
end
|
end
|
||||||
|
pitchBGM(self.replay_speed)
|
||||||
elseif e.input == "right" then
|
elseif e.input == "right" then
|
||||||
self.replay_speed = self.replay_speed + 1
|
self.replay_speed = self.replay_speed + 1
|
||||||
if self.replay_speed > 99 then
|
if self.replay_speed > 99 then
|
||||||
self.replay_speed = 99
|
self.replay_speed = 99
|
||||||
end
|
end
|
||||||
|
pitchBGM(self.replay_speed)
|
||||||
elseif e.input == "hold" then
|
elseif e.input == "hold" then
|
||||||
self.show_invisible = not self.show_invisible
|
self.show_invisible = not self.show_invisible
|
||||||
end
|
end
|
||||||
|
@ -47,8 +47,6 @@ function ReplaySelectScene:new()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ReplaySelectScene:update()
|
function ReplaySelectScene:update()
|
||||||
switchBGM(nil) -- experimental
|
|
||||||
|
|
||||||
if self.das_up or self.das_down or self.das_left or self.das_right then
|
if self.das_up or self.das_down or self.das_left or self.das_right then
|
||||||
self.das = self.das + 1
|
self.das = self.das + 1
|
||||||
else
|
else
|
||||||
|
@ -400,6 +400,7 @@ end
|
|||||||
|
|
||||||
function GameMode:onGameOver()
|
function GameMode:onGameOver()
|
||||||
switchBGM(nil)
|
switchBGM(nil)
|
||||||
|
pitchBGM(1)
|
||||||
local alpha = 0
|
local alpha = 0
|
||||||
local animation_length = 120
|
local animation_length = 120
|
||||||
if self.game_over_frames < animation_length then
|
if self.game_over_frames < animation_length then
|
||||||
|
Loading…
Reference in New Issue
Block a user