Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Fix rolling sound
Browse files Browse the repository at this point in the history
- Adds SoundInstance:pause()
- Pauses the rolling sound on pause
- Stops the rolling sound on exit to main menu
  • Loading branch information
ShamblesSM committed Jan 28, 2023
1 parent d759264 commit dd73b31
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Essentials/SoundInstance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ function SoundInstance:play()
self.sound:play()
end

function SoundInstance:pause()
self.sound:pause()
end

function SoundInstance:stop()
self.sound:stop()
end
Expand Down
11 changes: 11 additions & 0 deletions src/Level.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ function Level:update(dt)

if not self.pause then
self:updateLogic(dt * self.gameSpeed)
end
-- Rolling sound
if self.rollingSound then
if self.pause then
self.rollingSound:pause()
elseif (not self.pause) and self.controlDelay then
self.rollingSound:play()
end
end

self:updateMusic()
Expand Down Expand Up @@ -953,6 +961,9 @@ function Level:destroy()
end
if self.target then
self.target:destroy()
end
if self.rollingSound then
self.rollingSound:stop()
end

if self.ambientMusicName then
Expand Down

0 comments on commit dd73b31

Please sign in to comment.