local wd=love.window local Timer=love.timer.getTime Tmr={} function Tmr.load() local t=Timer() ::R:: if loading==1 then if loadnum<=#voiceList then local N=voiceList[loadnum] for i=1,#voice[N]do voice[N][i]=love.audio.newSource("VOICE/"..voice[N][i]..".ogg","static") end loadprogress=loadnum/#voiceList loadnum=loadnum+1 else loading=2 loadnum=1 end elseif loading==2 then if loadnum<=#bgm then local N=bgm[loadnum] bgm[N]=love.audio.newSource("/BGM/"..N..".ogg","stream") bgm[N]:setLooping(true) bgm[N]:setVolume(0) loadprogress=loadnum/#bgm loadnum=loadnum+1 else for i=1,#bgm do bgm[i]=nil end loading=3 loadnum=1 end elseif loading==3 then if loadnum<=#sfx then sfx[sfx[loadnum]]={love.audio.newSource("/SFX/"..sfx[loadnum]..".ogg","static")} loadprogress=loadnum/#sfx loadnum=loadnum+1 else for i=1,#sfx do sfx[i]=nil end loading=4 loadnum=1 end elseif loading==4 then loadnum=loadnum+1 if loadnum==15 then stat.run=stat.run+1 gotoScene("intro","none") end end end function Tmr.intro() count=count+1 if count==200 then count=80 end end function Tmr.draw() if clearSureTime>0 then clearSureTime=clearSureTime-1 end end function Tmr.play(dt) frame=frame+1 stat.time=stat.time+dt for i=#FX.beam,1,-1 do local b=FX.beam[i] b.t=b.t+1 local t0=b.t*.025--t in [0,1] local t=(sin(1.5*(2*t0-1))+1)*.5 PTC.attack[b.lv]:setPosition(b[1]+(b[3]-b[1])*t,b[2]+(b[4]-b[2])*t) PTC.attack[b.lv]:emit(1) if t0==1 then rem(FX.beam,i) end end for i=#FX.badge,1,-1 do local b=FX.badge[i] b.t=b.t+1 if b.t==60 then rem(FX.badge,i) end end for i=1,#virtualkey do if virtualkeyPressTime[i]>0 then virtualkeyPressTime[i]=virtualkeyPressTime[i]-1 end end PTC.attack[1]:update(dt) PTC.attack[2]:update(dt) PTC.attack[3]:update(dt) if frame<180 then if frame==179 then gameStart() elseif frame%60==0 then SFX("ready") end for p=1,#players do P=players[p] if P.keyPressing[1]or P.keyPressing[2]then P.moving=P.moving+(P.moving>0 and 1 or -1) else P.moving=0 end end if restartCount>0 then restartCount=restartCount-1 end return elseif players[1].keyPressing[10]then restartCount=restartCount+1 if restartCount>17 then clearTask("play") updateStat() resetGameData() end elseif restartCount>0 then restartCount=max(restartCount-2,0) end--Counting,include pre-das,directy RETURN,or restart counting for p=1,#players do P=players[p] if P.timing then P.stat.time=P.stat.time+dt end if P.alive then if not P.small then local v=0 for i=2,10 do v=v+i*(i-1)*7.2/(frame-P.keyTime[i])end P.keySpeed=P.keySpeed*.99+v*.1 v=0 for i=2,10 do v=v+i*(i-1)*7.2/(frame-P.dropTime[i])end P.dropSpeed=P.dropSpeed*.99+v*.1 --Update speeds if modeEnv.royaleMode then if P.keyPressing[9]then P.swappingAtkMode=min(P.swappingAtkMode+2,30) else P.swappingAtkMode=P.swappingAtkMode+((#P.field>15 and P.swappingAtkMode>4 or P.swappingAtkMode>8)and -1 or 1) end end end if P.ai and P.waiting==-1 then P.ai.controlDelay=P.ai.controlDelay-1 if P.ai.controlDelay==0 then if #P.ai.controls>0 then pressKey(P.ai.controls[1],P) releaseKey(P.ai.controls[1],P) rem(P.ai.controls,1) P.ai.controlDelay=P.ai.controlDelay0+1 else AI_getControls(P.ai.controls) P.ai.controlDelay=P.ai.controlDelay0+2 if Timer()-P.modeData.point>P.modeData.event then P.modeData.point=Timer() P.modeData.event=P.ai.controlDelay0+rnd(2,10) changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.35 and 2 or 3) end end end end if not P.keepVisible then for j=1,#P.field do for i=1,10 do if P.visTime[j][i]>0 then P.visTime[j][i]=P.visTime[j][i]-1 end end end end--Fresh visible time if P.keyPressing[1]or P.keyPressing[2]then P.moving=P.moving+(P.moving>0 and 1 or -1) local d=abs(P.moving)-P.gameEnv.das if d>1 then if P.gameEnv.arr>0 then if d%P.gameEnv.arr==0 then act[P.moving>0 and"moveRight"or"moveLeft"](true) end else act[P.moving>0 and"insRight"or"insLeft"]() end end else P.moving=0 end if P.keyPressing[7]and not P.keyPressing[9]then local d=abs(P.downing)-P.gameEnv.sddas P.downing=P.downing+1 if d>1 then if P.gameEnv.sdarr>0 then if d%P.gameEnv.sdarr==0 then act.down1() end else act.insDown() end end else P.downing=0 end if P.falling>=0 then P.falling=P.falling-1 if P.falling>=0 then goto stop end if P.human and P.gameEnv.fall>0 and #P.field>P.clearing[1]then SFX("fall")end for i=1,#P.clearing do removeRow(P.field,P.clearing[i]) removeRow(P.visTime,P.clearing[i]) end ::L:: rem(P.clearing) if P.clearing[1]then goto L end end if P.waiting>=0 then P.waiting=P.waiting-1 if P.waiting==-1 then resetblock()end goto stop end if P.curY~=P.y_img then if P.dropDelay>=0 then P.dropDelay=P.dropDelay-1 if P.dropDelay>=0 then goto stop end end drop() P.dropDelay=P.gameEnv.drop if P.freshTime<=P.gameEnv.freshLimit then P.lockDelay=P.gameEnv.lock end else P.lockDelay=P.lockDelay-1 if P.lockDelay>=0 then goto stop end drop() end ::stop:: if P.b2b1==P.b2b then elseif P.b2b1=0 then P.falling=P.falling-1 if P.falling>=0 then goto stop end if P.human and P.gameEnv.fall>0 and #P.field>P.clearing[1]then SFX("fall")end for i=1,#P.clearing do removeRow(P.field,P.clearing[i]) removeRow(P.visTime,P.clearing[i]) end ::L:: rem(P.clearing) if P.clearing[1]then goto L end end::stop:: if P.endCounter<40 then for j=1,#P.field do for i=1,10 do if P.visTime[j][i]<20 then P.visTime[j][i]=P.visTime[j][i]+.5 end end end--Make field visible end if P.b2b1>0 then P.b2b1=max(0,P.b2b1*.92-1)end --Dead end for i=#P.shade,1,-1 do local S=P.shade[i] S[1]=S[1]-1 if S[1]==0 then rem(P.shade,i) end end if P.fieldOffY>0 then P.fieldOffY=P.fieldOffY-(P.fieldOffY>3 and 2 or 1) end if P.fieldOffX~=0 then P.fieldOffX=P.fieldOffX-(P.fieldOffX>0 and 1 or -1) end for i=#P.bonus,1,-1 do local b=P.bonus[i] if b.inf then if b.t<30 then b.t=b.t+.5 end else b.t=b.t+b.speed if b.t>=60 then rem(P.bonus,i)end end end for i=#P.atkBuffer,1,-1 do local atk=P.atkBuffer[i] atk.time=atk.time+1 if not atk.sent then if atk.countdown>0 then atk.countdown=atk.countdown-garbageSpeed end else if atk.time>20 then rem(P.atkBuffer,i) end end end if P.fieldBeneath>0 then P.fieldBeneath=max(P.fieldBeneath-pushSpeed,0)end if not P.small then PTC.dust[p]:update(dt) end end if modeEnv.royaleMode and frame%120==0 then freshMostDangerous()end end function Tmr.pause(dt) if not gamefinished then pauseTime=pauseTime+dt end if pauseTimer<50 and not wd.isMinimized()then pauseTimer=pauseTimer+1 end end