use the resource table for audio samples

This commit is contained in:
Hersi 2022-03-29 04:27:12 +02:00
parent f227df0dee
commit 7704c45dd0
1 changed files with 7 additions and 7 deletions

View File

@ -351,7 +351,7 @@ end
local function render(deltaTime) local function render(deltaTime)
if not playedBgm then if not playedBgm then
game.PlaySample("titlescreen/bgm.wav", true) game.PlaySample(resources.audiosamples.bgm, true)
playedBgm = true playedBgm = true
end end
@ -387,15 +387,15 @@ local function onKnobsChange(direction)
if ((cursorIndex > oldCursorIndex and not (cursorIndex == 6 and oldCursorIndex == 1)) or if ((cursorIndex > oldCursorIndex and not (cursorIndex == 6 and oldCursorIndex == 1)) or
(cursorIndex == 1 and oldCursorIndex == 6)) then scrollingUp = true end (cursorIndex == 1 and oldCursorIndex == 6)) then scrollingUp = true end
game.PlaySample("titlescreen/cursor_change.wav") game.PlaySample(resources.audiosamples.cursorChange)
oldCursorIndex = cursorIndex oldCursorIndex = cursorIndex
end end
local function onButtonPressed(button) local function onButtonPressed(button)
if button == game.BUTTON_STA then if button == game.BUTTON_STA then
game.PlaySample("titlescreen/cursor_select.wav") game.PlaySample(resources.audiosamples.cursorSelect)
game.StopSample("titlescreen/bgm.wav") game.StopSample(resources.audiosamples.bgm)
callButtonAction() callButtonAction()
@ -418,8 +418,8 @@ local function onMousePressed(button)
if util.areaOverlap(mousePosX, mousePosY, if util.areaOverlap(mousePosX, mousePosY,
miscButtons.mainButton.x, miscButtons.mainButton.y, miscButtons.mainButton.w, miscButtons.mainButton.h) then miscButtons.mainButton.x, miscButtons.mainButton.y, miscButtons.mainButton.w, miscButtons.mainButton.h) then
game.StopSample("titlescreen/bgm.wav") game.StopSample(resources.audiosamples.bgm)
game.PlaySample("titlescreen/cursor_select.wav") game.PlaySample(resources.audiosamples.cursorSelect)
callButtonAction() callButtonAction()
return return
@ -453,7 +453,7 @@ local function onMousePressed(button)
end end
cursorIndex = (cursorIndex - 1 + changeIndex) % #buttons + 1 cursorIndex = (cursorIndex - 1 + changeIndex) % #buttons + 1
game.PlaySample("titlescreen/cursor_change.wav") game.PlaySample(resources.audiosamples.cursorChange)
end end