添加危险警告音效,整理代码

This commit is contained in:
MrZ626
2021-01-27 12:32:25 +08:00
parent 91ee6b9f56
commit 4af660666b
15 changed files with 37 additions and 24 deletions

View File

@@ -271,7 +271,7 @@ do
--Check setting file
if
type(SETTING.block)~="boolean"or
type(SETTING.spawn)~="number"or
type(SETTING.sfx_spawn)~="number"or
type(SETTING.ghost)~="number"or
type(SETTING.center)~="number"or
type(SETTING.grid)~="number"or

BIN
media/SFX/warning.ogg Normal file

Binary file not shown.

View File

@@ -295,7 +295,8 @@ SETTING={--Settings
--Sound
sfx=1,
spawn=.3,
sfx_spawn=.3,
sfx_warn=.3,
bgm=.7,
stereo=.7,
vib=0,

View File

@@ -311,9 +311,10 @@ return{
graphic="Video→",
sfx="SFX",
stereo="Stereo",
spawn="Spawning",
warn="Warning",
bgm="BGM",
stereo="Stereo",
vib="Vibration",
voc="Voice",
cv="Voice Pack",

View File

@@ -291,9 +291,10 @@ return{
graphic="Vidéo→",
sfx="Sons",
stereo="Stéréo",
spawn="Apparition",
warn="Alerte de danger",
bgm="Musique",
stereo="Stéréo",
vib="Vibration",
voc="Voix",
},

View File

@@ -310,9 +310,10 @@ return{
graphic="Vídeo→",
sfx="SFX",
stereo="Stereo",
spawn="Nascida",
warn="Alerta de perigo",
bgm="BGM",
stereo="Stereo",
vib="Vibração",
voc="Voz",
cv="Pacote de voz",

View File

@@ -291,9 +291,10 @@ return{
graphic="Video→",
sfx="SFX",
stereo="Estéreo",
spawn="Spawn de Pzas.",
warn="Alerta de Peligro",
bgm="BGM",
stereo="Estéreo",
vib="Vibración",
voc="Voces",
},

View File

@@ -183,9 +183,10 @@ return{
graphic="Video→",
sfx="#!#",
stereo="←~→",
spawn="#[]#",
warn="!↑↑↑!",
bgm="#~#",
stereo="←~→",
vib="=~=",
voc="~~~",
},

View File

@@ -86,6 +86,7 @@ return{
graphic="改画面→",
spawn="出块",
warn="警告",
bgm="",
vib="嗡嗡",
cv="",

View File

@@ -312,9 +312,10 @@ return{
graphic="画面设置→",
sfx="音效",
stereo="立体声",
spawn="方块生成",
warn="危险警告",
bgm="音乐",
stereo="立体声",
vib="振动",
voc="语音",
cv="语音包",

View File

@@ -16,7 +16,7 @@ return{
pauseLimit=true,
load=function()
PLY.newPlayer(1)
if SETTING.spawn==0 then
if SETTING.sfx_spawn==0 then
LOG.print(text.switchSpawnSFX,COLOR.yellow)
end
end,

View File

@@ -544,7 +544,7 @@ function Player.resetBlock(P)
--Spawn SFX
if P.sound and id<8 then
SFX.fplay(spawnSFX_name[id],SETTING.spawn)
SFX.fplay(spawnSFX_name[id],SETTING.sfx_spawn)
end
end
@@ -1651,7 +1651,6 @@ function Player.lose(P,force)
SYSFX.newShade(1.4,P.fieldX,P.fieldY,300*P.size,610*P.size)
SYSFX.newRectRipple(2,P.fieldX,P.fieldY,300*P.size,610*P.size)
SYSFX.newRipple(2,P.x+(475+25*(P.life<3 and P.life or 0)+12)*P.size,P.y+(665+12)*P.size,20)
--300+25*i,595
SFX.play("clear_3")
SFX.play("emit")

View File

@@ -1,8 +1,5 @@
local int,max,min,abs=math.floor,math.max,math.min,math.abs
local rem=table.remove
local resume=coroutine.resume
local status=coroutine.status
local assert=assert
local function updateLine(P)--Attacks, line pushing, cam moving
local bf=P.atkBuffer
@@ -95,13 +92,18 @@ local function updateFXs(P,dt)
TEXT.update(P.bonus)
end
end
local function updateTasks(P)
local L=P.tasks
for i=#L,1,-1 do
local tr=L[i].thread
assert(resume(tr))
if status(tr)=="dead"then
rem(L,i)
local updateTasks do--updateTasks(P)
local resume=coroutine.resume
local status=coroutine.status
local assert=assert
function updateTasks(P)
local L=P.tasks
for i=#L,1,-1 do
local tr=L[i].thread
assert(resume(tr))
if status(tr)=="dead"then
rem(L,i)
end
end
end
end

View File

@@ -248,6 +248,9 @@ function scene.update(dt)
elseif GAME.warnLVL>0 then
GAME.warnLVL=max(GAME.warnLVL-.026,0)
end
if GAME.warnLVL>1.126 and GAME.frame%30==0 then
SFX.fplay("warning",SETTING.sfx_warn)
end
end
local function drawAtkPointer(x,y)

View File

@@ -62,9 +62,10 @@ scene.widgetList={
WIDGET.newButton{name="graphic",x=1080, y=80,w=240,h=80,color="lCyan",font=35,code=swapScene"setting_video","swipeL"},
WIDGET.newSlider{name="sfx", x=180, y=200,w=400, font=35,change=function()SFX.play("blip_1")end, disp=lnk_SETval("sfx"),code=lnk_SETsto("sfx")},
WIDGET.newSlider{name="stereo", x=180, y=500,w=400, font=35,change=function()SFX.play("move",1,-1)SFX.play("lock",1,1)end,disp=lnk_SETval("stereo"),code=lnk_SETsto("stereo"),hide=function()return SETTING.sx==0 end},
WIDGET.newSlider{name="spawn", x=180, y=300,w=400, font=30,change=function()SFX.fplay("spawn_"..math.random(7),SETTING.spawn)end,disp=lnk_SETval("spawn"),code=lnk_SETsto("spawn")},
WIDGET.newSlider{name="bgm", x=180, y=400,w=400, font=35, disp=lnk_SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end},
WIDGET.newSlider{name="spawn", x=180, y=300,w=400, font=30,change=function()SFX.fplay("spawn_"..math.random(7),SETTING.sfx_spawn)end,disp=lnk_SETval("sfx_spawn"),code=lnk_SETsto("sfx_spawn")},
WIDGET.newSlider{name="warn", x=180, y=400,w=400, font=30,change=function()SFX.fplay("warning",SETTING.sfx_warn)end,disp=lnk_SETval("sfx_warn"),code=lnk_SETsto("sfx_warn")},
WIDGET.newSlider{name="bgm", x=180, y=500,w=400, font=35, disp=lnk_SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end},
WIDGET.newSlider{name="stereo", x=180, y=600,w=400, font=35,change=function()SFX.play("move",1,-1)SFX.play("lock",1,1)end,disp=lnk_SETval("stereo"),code=lnk_SETsto("stereo"),hide=function()return SETTING.sx==0 end},
WIDGET.newSlider{name="vib", x=750, y=200,w=400,unit=5, font=25,change=function()VIB(2)end, disp=lnk_SETval("vib"),code=lnk_SETsto("vib")},
WIDGET.newSlider{name="voc", x=750, y=300,w=400, font=35,change=function()VOC.play("test")end, disp=lnk_SETval("voc"),code=lnk_SETsto("voc")},
WIDGET.newSelector{name="cv", x=1100, y=380,w=200, list={"miya","naki"}, disp=function()return cv end,code=function(i)cv=i end},