mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-12-25 08:19:03 -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 pitch = 1
|
||||
local bgm_locked = false
|
||||
|
||||
function switchBGM(sound, subsound)
|
||||
@ -84,5 +85,13 @@ end
|
||||
function resumeBGM()
|
||||
if current_bgm ~= nil then
|
||||
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
|
||||
|
@ -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()
|
||||
elseif e.input == "retry" then
|
||||
switchBGM(nil)
|
||||
pitchBGM(1)
|
||||
self.game:onExit()
|
||||
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
|
||||
|
@ -107,6 +107,8 @@ function ReplayScene:onInputPress(e)
|
||||
e.input == "menu_decide" or
|
||||
e.input == "retry"
|
||||
) then
|
||||
switchBGM(nil)
|
||||
pitchBGM(1)
|
||||
self.game:onExit()
|
||||
loadSave()
|
||||
love.math.setRandomSeed(os.time())
|
||||
@ -126,11 +128,13 @@ function ReplayScene:onInputPress(e)
|
||||
if self.replay_speed < 1 then
|
||||
self.replay_speed = 1
|
||||
end
|
||||
pitchBGM(self.replay_speed)
|
||||
elseif e.input == "right" then
|
||||
self.replay_speed = self.replay_speed + 1
|
||||
if self.replay_speed > 99 then
|
||||
self.replay_speed = 99
|
||||
end
|
||||
pitchBGM(self.replay_speed)
|
||||
elseif e.input == "hold" then
|
||||
self.show_invisible = not self.show_invisible
|
||||
end
|
||||
|
@ -47,8 +47,6 @@ function ReplaySelectScene:new()
|
||||
end
|
||||
|
||||
function ReplaySelectScene:update()
|
||||
switchBGM(nil) -- experimental
|
||||
|
||||
if self.das_up or self.das_down or self.das_left or self.das_right then
|
||||
self.das = self.das + 1
|
||||
else
|
||||
|
@ -400,6 +400,7 @@ end
|
||||
|
||||
function GameMode:onGameOver()
|
||||
switchBGM(nil)
|
||||
pitchBGM(1)
|
||||
local alpha = 0
|
||||
local animation_length = 120
|
||||
if self.game_over_frames < animation_length then
|
||||
|
Loading…
Reference in New Issue
Block a user