Skip to content

Commit b076fd9

Browse files
authored
1.5.1
1 parent 5b70ceb commit b076fd9

File tree

2 files changed

+31
-17
lines changed

2 files changed

+31
-17
lines changed

main.lua

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ uiBlockSize = 11
8383
shake, sash, ghost,
8484
grid, darkMode,
8585
inverseRotation,
86-
music, sounds,
86+
musicVolume, soundsVolume,
8787
bigBlocks
8888
=
8989
loadData("shake") or true, loadData("sash") or true, loadData("ghost") or true,
@@ -165,10 +165,22 @@ local holdSound = loadSound("hold")
165165
local menuScrollSound = loadSound("menu-scroll")
166166
local menuClickSound = loadSound("menu-click")
167167

168+
local sfx = {
169+
dropSound,
170+
tetrisSound,
171+
holdSound,
172+
menuScrollSound,
173+
menuClickSound
174+
}
175+
168176
-- holy shit it finally was added
169177
local bgmIntro = loadMusic("bgmintro")
170178
local bgmLoop = loadMusic("bgmloop")
171179

180+
local songs = {
181+
bgmIntro, bgmLoop
182+
}
183+
172184
------------
173185
-- images --
174186
------------
@@ -764,21 +776,21 @@ local menu = {
764776
type = "slider",
765777
min = 0,
766778
max = 1,
767-
value = music,
779+
value = musicVolume,
768780
onchange = function(val)
769-
music = val
770-
saveData("music", music)
781+
musicVolume = val
782+
saveData("music", musicVolume)
771783
end,
772784
},
773785
{
774786
name = "Sound",
775787
type = "slider",
776788
min = 0,
777789
max = 1,
778-
value = sounds,
790+
value = soundsVolume,
779791
onchange = function(val)
780-
sounds = val
781-
saveData("sounds", sounds)
792+
soundsVolume = val
793+
saveData("sounds", soundsVolume)
782794
end,
783795
},
784796
}
@@ -879,11 +891,8 @@ function drawMenu()
879891
local menuItem = menu[menuCursor+1]
880892
local x = dwidth/2-menuWidth/2
881893
local w = bold:getTextWidth(menu[menuCursor+1].name)
882-
if menuItem.type == "crossmark" then
883-
x = dwidth/2-menuWidth/2 + 20
884-
elseif menuItem.type == "slider" then
885-
w = menuWidth
886-
end
894+
if menuItem.type == "crossmark" then x += 20
895+
elseif menuItem.type == "slider" then w = menuWidth end
887896
gfx.drawRect(
888897
x, ((menuYTimer.value-menuHeight/2)+menuCursor*bheight)-2.5, w, bheight, 2
889898
)
@@ -932,10 +941,15 @@ function playdate.update()
932941
if not bgmIntro:isPlaying() and not bgmLoop:isPlaying() then
933942
bgmLoop:play(0)
934943
end
935-
bgmIntro:setVolume(music-(menuOpen and 0.5 or 0))
936-
bgmLoop:setVolume(music-(menuOpen and 0.5 or 0))
937-
for k,v in pairs(snd.playingSources()) do
938-
if tostring(v):find("sampleplayer") then v:setVolume(sounds) end
944+
for i,v in ipairs(songs) do
945+
if v:getVolume() ~= musicVolume then
946+
v:setVolume(musicVolume)
947+
end
948+
end
949+
for i,v in ipairs(sfx) do
950+
if v:getVolume() ~= soundsVolume then
951+
v:setVolume(soundsVolume)
952+
end
939953
end
940954
_update()
941955
_draw()

pdxinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name=Playtris
22
author=@thacuber2a03
33
description=It's some random tetromino game for the Playdate console. And that's about it.
4-
version=1.5
4+
version=1.5.1
55
imagePath=launcher
66
bundleID=com.thacuber.tetris

0 commit comments

Comments
 (0)