Skip to content

Commit

Permalink
exterior音乐室可以主动触发glitch效果
Browse files Browse the repository at this point in the history
修改glitch视效方法名
  • Loading branch information
MrZ626 committed Sep 28, 2024
1 parent cf3aeca commit 59f4d54
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 16 deletions.
22 changes: 13 additions & 9 deletions assets/gamefunc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@ function sureCheck(event)
end
end

function drawInteriorGlitch()
GC.replaceTransform(SCR.origin)
function drawGlitch()
local setc,rect=GC.setColor,GC.rectangle
local t=love.timer.getTime()
local cellSize=math.min(SCR.w,SCR.h)/26
GC.replaceTransform(SCR.origin)
for x=0,SCR.w,cellSize do
for y=0,SCR.h,cellSize do
setc(1,1,1,(math.floor(t*2.6)*(x*26+62)*(y*42+24))/10%2.6%.042)
rect('fill',x,y,cellSize,cellSize)
end
end

-- GC.scale(1,SCR.h)
-- local a=1/26
-- for i=0,26 do
-- setc(1,1,1,(math.floor(t*2.6+i/6)*(26+i))%0.026)
-- rect('fill',0,a*(i-t%1),SCR.w,a*.42)
-- end
end
function drawGlitch2()
local setc,rect=GC.setColor,GC.rectangle
local t=love.timer.getTime()
local a=1/26
GC.replaceTransform(SCR.origin)
GC.scale(1,SCR.h)
for i=0,26 do
setc(1,1,1,(math.floor(t*2.6+i/6)*(26+i))%0.0355)
rect('fill',0,a*(i-2.6*t%1),SCR.w,a*.355)
end
end

local _bgmPlaying ---@type string?
Expand Down
1 change: 1 addition & 0 deletions assets/progress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ function PROGRESS.applyExteriorBG() BG.set(prgs.main==3 and 'space' or 'galaxy')
local function fuse()
repeat TASK.yieldT(6.26) until SCN.cur~='main_in'
FMOD.effect.keyOff('music_glitch')
TASK.unlock('musicroom_glitchFX')
end
function PROGRESS.applyInteriorBGM()
playBgm('blank',prgs.main~=1)
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/keyset_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ end
function scene.overDraw()
-- Glitch effect after III
if PROGRESS.get('main')>=3 then
drawInteriorGlitch()
drawGlitch()
end
end

Expand Down
2 changes: 1 addition & 1 deletion assets/scene/keyset_touch_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function scene.draw() VCTRL.draw(true) end
function scene.overDraw()
-- Glitch effect after III
if PROGRESS.get('main')>=3 then
drawInteriorGlitch()
drawGlitch()
end
end

Expand Down
2 changes: 1 addition & 1 deletion assets/scene/lang_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ end
function scene.overDraw()
-- Glitch effect after III
if PROGRESS.get('main')>=3 then
drawInteriorGlitch()
drawGlitch()
end
end

Expand Down
2 changes: 1 addition & 1 deletion assets/scene/main_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function scene.overDraw()

-- Glitch effect after III
if PROGRESS.get('main')>=3 then
drawInteriorGlitch()
drawGlitch()
end
end

Expand Down
20 changes: 19 additions & 1 deletion assets/scene/musicroom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ local function searchMusic(str)
musicListBox:select(bestID)
end
end
local function timeBomb()
TASK.yieldT(26)
if TASK.getLock('musicroom_glitchFX') then
FMOD.effect.keyOff('music_glitch')
TASK.unlock('musicroom_glitchFX')
end
end
function scene.keyDown(key,isRep)
scene.focus(true)
local act=KEYMAP.sys:getAction(key)
Expand All @@ -140,7 +147,7 @@ function scene.keyDown(key,isRep)
if FMOD.music.getPlaying() then
local now=FMOD.music.tell()
local dur=FMOD.music.getDuration()
FMOD.music.seek(key=='left' and max(now-5,0) or (now+5)%dur)
FMOD.music.seek(act=='left' and max(now-5,0) or (now+5)%dur)
end
elseif key=='backspace' or key=='delete' then
searchStr=""
Expand Down Expand Up @@ -183,6 +190,11 @@ function scene.keyDown(key,isRep)
elseif key=='`' and isAltPressed() then
noProgress=true
scene.load()
elseif key=='f3' then
if TASK.lock('musicroom_glitchFX') then
FMOD.effect('music_glitch')
TASK.new(timeBomb)
end
end
end
return true
Expand Down Expand Up @@ -331,6 +343,12 @@ function scene.draw()
end
end

function scene.overDraw()
if TASK.getLock('musicroom_glitchFX') then
drawGlitch2()
end
end

scene.widgetList={
{type='button_fill',pos={0,0},x=120,y=60,w=180,h=70,color='B',cornerR=15,sound_trigger='button_back',fontSize=40,text=backText,code=WIDGET.c_backScn'fadeHeader'},
{type='text',pos={0,0},x=240,y=60,alignX='left',fontType='bold',fontSize=60,text=LANG'musicroom_title'},
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/setting_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function scene.overDraw()

-- Glitch effect after III
if PROGRESS.get('main')>=3 then
drawInteriorGlitch()
drawGlitch()
end
end

Expand Down
2 changes: 1 addition & 1 deletion assets/scene/tutorial_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ end
function scene.overDraw()
-- Glitch effect after III
if PROGRESS.get('main')>=3 then
drawInteriorGlitch()
drawGlitch()
end
end

Expand Down

0 comments on commit 59f4d54

Please sign in to comment.