diff --git a/BGM/cruelty.ogg b/BGM/cruelty.ogg new file mode 100644 index 00000000..04191c89 Binary files /dev/null and b/BGM/cruelty.ogg differ diff --git a/BGM/final.ogg b/BGM/final.ogg new file mode 100644 index 00000000..24f69657 Binary files /dev/null and b/BGM/final.ogg differ diff --git a/albbph.ttf b/albbph.ttf new file mode 100644 index 00000000..7eb047f4 Binary files /dev/null and b/albbph.ttf differ diff --git a/call&sys.lua b/call&sys.lua index d5c43921..8a68c5da 100644 --- a/call&sys.lua +++ b/call&sys.lua @@ -16,7 +16,9 @@ end function buttonControl_key(i) if i=="up"or i=="down"or i=="left"or i=="right"then if not Buttons.sel then - Buttons.sel=1 + if Buttons[scene][1]then + Buttons.sel=1 + end else Buttons.sel=Buttons[scene][Buttons.sel][i]or Buttons.sel end @@ -32,7 +34,9 @@ end function buttonControl_gamepad(i) if i=="dpup"or i=="dpdown"or i=="dpleft"or i=="dpright"then if not Buttons.sel then - Buttons.sel=1 + if Buttons[scene][1]then + Buttons.sel=1 + end mouseShow=false else Buttons.sel=Buttons[scene][Buttons.sel][i=="dpup"and"up"or i=="dpdown"and"down"or i=="dpleft"and"left"or"right"]or Buttons.sel @@ -66,11 +70,25 @@ function keyDown.intro(key) end function keyDown.mode(key) if key=="down"then - if modeSel<#modeID then modeSel=modeSel+1 end + if modeSel<#modeID then + modeSel=modeSel+1 + levelSel=ceil(#modeLevel[modeID[modeSel]]*.5) + end elseif key=="up"then - if modeSel>1 then modeSel=modeSel-1 end + if modeSel>1 then + modeSel=modeSel-1 + levelSel=ceil(#modeLevel[modeID[modeSel]]*.5) + end + elseif key=="left"then + if levelSel>1 then + levelSel=levelSel-1 + end + elseif key=="right"then + if levelSel<#modeLevel[modeID[modeSel]]then + levelSel=levelSel+1 + end elseif key=="return"then - startGame(modeID[modeSel]) + loadGame(modeID[modeSel],levelSel) elseif key=="c"then gotoScene("custom") elseif key=="escape"then @@ -89,7 +107,7 @@ function keyDown.custom(key) elseif key=="up"then optSel=(optSel-2)%#customID+1 elseif key=="return"then - startGame("custom") + loadGame("custom",1) elseif key=="escape"then back() end @@ -167,7 +185,7 @@ function gamepadDown.mode(key) elseif key=="dpup"then if modeSel>1 then modeSel=modeSel-1 end elseif key=="start"then - startGame(modeID[modeSel]) + loadGame(modeID[modeSel],levelSel) elseif key=="back"then back() end @@ -234,6 +252,7 @@ end wheelmoved={} function wheelmoved.mode(x,y) modeSel=min(max(modeSel-sgn(y),1),#modeID) + levelSel=ceil(#modeLevel[modeID[modeSel]]*.5) end --Warning,these are not system callbacks! @@ -347,7 +366,7 @@ function love.touchmoved(id,x,y,dx,dy) break end end - if not p and players[1].keyPressing then + if not p and players[1].isKeyDown then releaseKey(n,players[1]) end end @@ -362,10 +381,39 @@ function love.touchmoved(id,x,y,dx,dy) end function love.keypressed(i) - if i=="f12"then devMode=true end - if keyDown[scene]then keyDown[scene](i) - elseif i=="escape"or i=="back"then back() - else buttonControl_key(i) + if i=="f12"then devMode=not devMode end + if devMode then + if Buttons.sel then + local B=Buttons[scene][Buttons.sel] + if i=="left"then + B.x=B.x-10 + elseif i=="right"then + B.x=B.x+10 + elseif i=="up"then + B.y=B.y-10 + elseif i=="down"then + B.y=B.y+10 + elseif i==","then + B.w=B.w-10 + elseif i=="."then + B.w=B.w+10 + elseif i=="/"then + B.h=B.h-10 + elseif i=="'"then + B.h=B.h+10 + end + end + if i=="q"then + for i=1,#Buttons[scene]do + local B=Buttons[scene][i] + print(format("x=%d,y=%d,w=%d,h=%d",B.x,B.y,B.w,B.h)) + end + end + else + if keyDown[scene]then keyDown[scene](i) + elseif i=="escape"or i=="back"then back() + else buttonControl_key(i) + end end mouseShow=false end @@ -376,9 +424,10 @@ end function love.gamepadpressed(joystick,i) if gamepadDown[scene]then return gamepadDown[scene](i) - elseif i=="back"then return back() + elseif i=="back"then back() else buttonControl_gamepad(i) end + mouseShow=false end function love.gamepadreleased(joystick,i) if gamepadUp[scene]then gamepadUp[scene](i) @@ -418,8 +467,6 @@ function love.update(dt) BGblock.ct=rnd(20,30) end end - --Background blocks update - if sceneSwaping then sceneSwaping.time=sceneSwaping.time-1 if sceneSwaping.time==sceneSwaping.mid then @@ -434,7 +481,7 @@ function love.update(dt) elseif Tmr[scene]then Tmr[scene](dt) end - --scene swapping & Timer + updateButton() end function love.sendData(data) return nil @@ -453,7 +500,7 @@ function love.draw() if b[i][j]>0 then gc.draw(img,BGblock[n].x+(j-1)*30*size,BGblock[n].y+(i-1)*30*size,nil,size) end - end end--Block + end end end if Pnt[scene]then Pnt[scene]()end drawButton() @@ -520,7 +567,7 @@ function love.run() if bgmPlaying then bgm[bgmPlaying]:pause()end if scene=="play"then for i=1,#players.alive do - local l=players.alive[i].keyPressing + local l=players.alive[i].isKeyDown for j=1,#l do if l[j]then releaseKey(j,players.alive[i]) diff --git a/conf.lua b/conf.lua index 12d86d4c..a9977114 100644 --- a/conf.lua +++ b/conf.lua @@ -9,7 +9,7 @@ function love.conf(t) t.audio.mixwithsystem=true--Switch on to keep sysBGM local W=t.window - W.title="Techmino V0.7.5" + W.title="Techmino V0.7.6" W.icon="/image/icon.png" W.width,W.height=1280,720 W.borderless=X diff --git a/gamefunc.lua b/gamefunc.lua index b6d3c7ce..a7c50369 100644 --- a/gamefunc.lua +++ b/gamefunc.lua @@ -1,8 +1,15 @@ +function loadGame(mode,level) + --rec={} + gameMode,gameLevel=mode,level + gotoScene("play") +end function resetGameData() frame=0 + pushSpeed,garbageSpeed=3,1 players={alive={}} - loadmode[gamemode]() + modeEnv=defaultModeEnv[gameMode][gameLevel]or defaultModeEnv[gameMode][1] + loadmode[gameMode]() FX.beam={} for k,v in pairs(PTC.dust)do @@ -16,14 +23,12 @@ function resetGameData() end if modeEnv.royaleMode then for i=1,#players do - local P=players[i] - if not P.atking then - repeat - P.atking=players.alive[rnd(#players.alive)] - until P.atking~=P - end + changeAtk(players[i],randomTarget(players[i])) end mostBadge,mostDangerous,secBadge,secDangerous=nil + gameStage=1 + pushSpeed=2 + garbageSpeed=.3 end for i=1,#virtualkey do virtualkey[i].press=false @@ -63,7 +68,7 @@ function createPlayer(id,x,y,size,AIspeed,data) if AIspeed then P.ai={ controls={}, - controlDelay=60, + controlDelay=30, controlDelay0=AIspeed, } end @@ -80,7 +85,8 @@ function createPlayer(id,x,y,size,AIspeed,data) P.ko,P.badge,P.strength=0,0,0 - P.atkMode,P.swappingAtkMode,P.atking,P.lastRecv=1,20 + P.atkMode,P.swappingAtkMode=1,20 + P.atker,P.atking,P.lastRecv={} --Royale-related P.gameEnv={}--Game setting vars,like dropDelay setting @@ -100,16 +106,28 @@ function createPlayer(id,x,y,size,AIspeed,data) P.nxt,P.nb={},{} P.dropDelay,P.lockDelay=P.gameEnv.drop,P.gameEnv.lock P.freshTime=0 - P.lastSpin=false - if P.gameEnv.sequence==3 then + P.spinLast,P.lastClear=nil + if P.gameEnv.sequence<3 then + local bag1={1,2,3,4,5,6,7} + for i=1,7 do + P.nxt[i]=rem(bag1,rnd(#bag1)) + P.nb[i]=blocks[P.nxt[i]][0] + end + elseif P.gameEnv.sequence==3 then for i=1,6 do local r=rnd(7) P.nxt[i]=r P.nb[i]=blocks[r][0] end - elseif P.gameEnv.sequence<5 then - local bag1={1,2,3,4,5,6,7} - for i=1,7 do + elseif P.gameEnv.sequence==5 then + local bag1={1,2,3,4,5,6} + for i=1,6 do + P.nxt[i]=rem(bag1,rnd(#bag1)) + P.nb[i]=blocks[P.nxt[i]][0] + end--First bag + elseif P.gameEnv.sequence==6 then + local bag1={1,2,3,4,6,7} + for i=1,6 do P.nxt[i]=rem(bag1,rnd(#bag1)) P.nb[i]=blocks[P.nxt[i]][0] end--First bag @@ -123,7 +141,7 @@ function createPlayer(id,x,y,size,AIspeed,data) P.showTime=P.gameEnv.visible==1 and 1e99 or P.gameEnv.visible==2 and 300 or 20 P.cb,P.sc,P.bn,P.r,P.c,P.cx,P.cy,P.dir,P.y_img={{}},{0,0},1,0,0,0,0,0,0 - P.keyPressing={}for i=1,12 do P.keyPressing[i]=false end + P.keyPressing,P.isKeyDown={},{}for i=1,12 do P.keyPressing[i],P.isKeyDown[i]=false,false end P.moving,P.downing=0,0 P.waiting,P.falling=0,0 P.clearing={} @@ -138,9 +156,9 @@ function createPlayer(id,x,y,size,AIspeed,data) P.task={} P.bonus={} end -function showText(text,type,font,dy,inf) +function showText(P,text,type,font,dy,spd,inf) if not P.small then - ins(P.bonus,{t=0,text=text,draw=FX[type],font=font,dy=dy or 0,inf=inf,solid=inf}) + ins(P.bonus,{t=0,text=text,draw=FX[type],font=font,dy=dy or 0,speed=spd or 1,inf=inf}) end end function createBeam(S,R,lv)--Player id @@ -167,9 +185,9 @@ function throwBadge(S,R,amount)--Player id if R.small then x2,y2=R.x+150*R.size,R.y+300*R.size else - x2,y2=R.x+308*R.size,R.y+450*R.size + x2,y2=R.x+73*R.size,R.y+360*R.size end - ins(FX.badge,{x1,y1,x2,y2,t=0,size=(10+min(amount,10))*.1}) + ins(FX.badge,{x1,y1,x2,y2,t=0,size=(9+min(amount,12))*.1}) end function randomTarget(p) if #players.alive>1 then @@ -180,6 +198,41 @@ function randomTarget(p) return r end end +function freshTarget(P) + if P.atkMode==1 then + if not P.atking.alive or rnd()<.1 then + changeAtk(P,randomTarget(P)) + end + elseif P.atkMode==2 then + changeAtk(P,P~=mostBadge and mostBadge or secBadge or randomTarget(P)) + elseif P.atkMode==3 then + changeAtk(P,P~=mostDangerous and mostDangerous or secDangerous or randomTarget(P)) + elseif P.atkMode==4 then + for i=1,#P.atker do + if not P.atker[i].alive then + rem(P.atker,i) + break + end + end + end +end +function changeAtk(P,R) + if P.atking then + local K=P.atking.atker + for i=1,#K do + if K[i]==P then + rem(K,i) + break + end + end + end + if R then + P.atking=R + ins(R.atker,P) + else + P.atking=nil + end +end function freshRoyaleTarget() mostBadge,secBadge,mostDangerous,secDangerous=nil local h,b=0,0 @@ -190,19 +243,41 @@ function freshRoyaleTarget() end if #players.alive[i].field>=b then mostDangerous,secDangerous=players.alive[i],mostDangerous - b=#players[i].field + b=#players.alive[i].field end end +end +function royaleLevelup() + gameStage=gameStage+1 + local s + if(gameStage==3 or gameStage>4)and players[1].alive then + showText(players[1],#players.alive.." Players Remain","beat",50,-100,.3) + end + if gameStage==2 then + s=30 + elseif gameStage==3 then + s=15 + garbageSpeed=.6 + BGM("cruelty") + elseif gameStage==4 then + s=10 + pushSpeed=3 + elseif gameStage==5 then + s=5 + garbageSpeed=1 + elseif gameStage==6 then + s=3 + BGM("final") + end for i=1,#players.alive do local P=players.alive[i] - if P.atkMode==1 then - if not P.atking then - P.atking=randomTarget(P) - end - elseif P.atkMode==2 then - P.atking=P~=mostBadge and mostBadge or secBadge - elseif P.atkMode==3 then - P.atking=P~=mostDangerous and mostDangerous or secDangerous + P.gameEnv.drop=s + end + if gameLevel==5 and players[1].alive then + local P=players[1] + P.gameEnv.drop=int(P.gameEnv.drop*.3) + if P.gameEnv.drop==0 then + P.gameEnv._20G=true end end end @@ -285,6 +360,7 @@ end function pressKey(i,p) P=p P.keyPressing[i]=true + P.isKeyDown[i]=true if i==10 then act.restart() elseif P.alive then @@ -294,7 +370,7 @@ function pressKey(i,p) elseif P.keyPressing[9]then if i==1 then P.atkMode=1 - P.atking=randomTarget(P) + changeAtk(P,randomTarget(P)) elseif i==2 then P.atkMode=2 elseif i==6 then @@ -317,6 +393,7 @@ function pressKey(i,p) end function releaseKey(i,p) p.keyPressing[i]=false + P.isKeyDown[i]=false -- if playmode=="recording"then ins(rec,{-i,frame})end end function spin(d,ifpre) @@ -373,7 +450,7 @@ function hold(ifpre) freshgho() P.dropDelay,P.lockDelay,P.freshTime=P.gameEnv.drop,P.gameEnv.lock,0 - if ifoverlap(P.cb,P.cx,P.cy) then lock()Event.gameover.lose()end + if ifoverlap(P.cb,P.cx,P.cy)then lock()Event.gameover.lose()end P.holded=P.gameEnv.oncehold SFX(ifpre and"prehold"or"hold") if P.id==1 then @@ -425,98 +502,94 @@ function drop() P.combo=P.combo+1--combo=0 is under if cc==4 then if P.b2b>480 then - showText("Techrash B2B2B","fly",70) + showText(P,"Techrash B2B2B","fly",70) csend=6 sendTime=80 exblock=exblock+1 elseif P.b2b>=30 then - showText("Techrash B2B","drive",70) + showText(P,"Techrash B2B","drive",70) sendTime=70 csend=5 else - showText("Techrash","stretch",80) + showText(P,"Techrash","stretch",80) sendTime=60 csend=4 end P.b2b=P.b2b+100 + P.lastClear=74 P.cstat.techrash=P.cstat.techrash+1 elseif cc>0 then if dospin then if P.b2b>480 then - showText(spinName[cc][P.bn].." B2B2B","spin",40) + showText(P,spinName[cc][P.bn].." B2B2B","spin",40) csend=b2bATK[cc]+1 exblock=exblock+1 elseif P.b2b>=30 then - showText(spinName[cc][P.bn].." B2B","spin",40) + showText(P,spinName[cc][P.bn].." B2B","spin",40) csend=b2bATK[cc] else - showText(spinName[cc][P.bn],"spin",50) + showText(P,spinName[cc][P.bn],"spin",50) csend=2*cc end sendTime=20+csend*20 if mini then - showText("Mini","drive",40,10) + showText(P,"Mini","drive",40,10) csend=ceil(csend*.5) sendTime=sendTime+60 P.b2b=P.b2b+b2bPoint[cc]*.8 else P.b2b=P.b2b+b2bPoint[cc] end - SFX(spin_n[cc]) + P.lastClear=P.bn*10+cc if P.id==1 then stat.spin=stat.spin+1 end + SFX(spin_n[cc]) elseif #P.clearing<#P.field then P.b2b=P.b2b-150-cc*50 - showText(clearName[cc],"appear",50) + showText(P,clearName[cc],"appear",50) csend=cc-1 sendTime=20+csend*20 + P.lastClear=cc + end + if #P.clearing==#P.field then + showText(P,"Perfect Clear","flicker",70,-80) + csend=csend+min(6+P.cstat.pc,10) + exblock=exblock+2 + sendTime=sendTime+30 + if P.cstat.row>4 then + P.b2b=600 + end + P.cstat.pc=P.cstat.pc+1 + P.lastClear=P.bn*10+5 + SFX("perfectclear") end else P.combo=0 if dospin then - showText(spinName[0][P.bn],"appear",50) + showText(P,spinName[0][P.bn],"appear",50) SFX("spin_0") P.b2b=P.b2b+15 end end - if cc>0 and #P.clearing==#P.field then - showText("Perfect Clear","flicker",70,-80) - csend=csend+min(6+P.cstat.pc,10) - exblock=exblock+2 - sendTime=sendTime+30 - if P.cstat.row>10 then - P.b2b=600 - end - SFX("perfectclear") - P.cstat.pc=P.cstat.pc+1 - end - csend=csend+(renATK[P.combo]or 4) if P.combo>2 then - showText(renName[min(P.combo,20)],P.combo<10 and"appear"or"flicker",20+P.combo*3,60) + showText(P,renName[min(P.combo,20)],P.combo<10 and"appear"or"flicker",20+P.combo*3,60) end sendTime=sendTime+20*P.combo if cc>0 then SFX(clear_n[cc]) SFX(ren_n[min(P.combo,11)]) + VIB(cc<3 and 1 or cc-1) end P.b2b=max(min(P.b2b,600),0) if cc>0 and modeEnv.royaleMode then - local atker=0 - for i=1,#players.alive do - if players.alive[i].atking==P then - atker=atker+1 - if atker==9 then - break - end - end - end - if atker>1 then - csend=csend+reAtk[atker] - exblock=exblock+reDef[atker] + local i=min(#P.atker,9) + if i>1 then + csend=csend+reAtk[i] + exblock=exblock+reDef[i] end end @@ -532,9 +605,9 @@ function drop() --ATK statistics if csend>0 then - showText(csend,"zoomout",25,70) + showText(P,csend,"zoomout",25,70) if exblock>0 then - showText(exblock,"zoomout",10,70) + showText(P,exblock,"zoomout",10,70) end end while csend>0 and P.atkBuffer[1]do @@ -555,18 +628,16 @@ function drop() if csend>0 then if modeEnv.royaleMode then if P.atkMode==4 then - local f - for i=1,#players.alive do - if players.alive[i].atking==P then - garbageSend(P,players.alive[i],csend,sendTime) - f=true + if #P.atker>0 then + for i=1,#P.atker do + garbageSend(P,P.atker[i],csend,sendTime) end - end - if not f then - garbageSend(P,P.atking or randomTarget(P),csend,sendTime) + else + garbageSend(P,randomTarget(P),csend,sendTime) end else - garbageSend(P,P.atking or randomTarget(P),csend,sendTime) + freshTarget(P) + garbageSend(P,P.atking,csend,sendTime) end elseif #players.alive>1 then garbageSend(P,randomTarget(P),csend,sendTime) @@ -616,7 +687,7 @@ function garbageRelease() local t=P.showTime*2 for i=1,#P.atkBuffer do local atk=P.atkBuffer[i] - if not atk.sent and atk.countdown==0 then + if not atk.sent and atk.countdown<=0 then for j=1,atk.amount do ins(P.field,1,getNewRow(13)) ins(P.visTime,1,getNewRow(t)) @@ -635,6 +706,7 @@ act={ if P.keyPressing[9]then if P.atkMode~=1 then P.atkMode=1 + changeAtk(P,randomTarget(P)) end else if not auto then @@ -653,7 +725,7 @@ act={ if P.keyPressing[9]then if P.atkMode~=2 then P.atkMode=2 - P.atking=P~=mostBadge and mostBadge or secBadge + changeAtk(P,P~=mostBadge and mostBadge or secBadge or randomTarget(P)) end else if not auto then @@ -675,7 +747,7 @@ act={ if P.keyPressing[9]then if P.atkMode~=3 then P.atkMode=3 - P.atking=P~=mostDangerous and mostDangerous or secDangerous + changeAtk(P,P~=mostDangerous and mostDangerous or secDangerous or randomTarget(P)) end else if P.waiting<=0 then @@ -683,6 +755,7 @@ act={ P.cy=P.y_img P.spinLast=false SFX("drop") + VIB(0) end drop() end @@ -692,7 +765,7 @@ act={ if P.keyPressing[9]then if P.atkMode~=4 then P.atkMode=4 - P.atking=nil + changeAtk(P) end else if P.cy~=P.y_img then @@ -718,7 +791,7 @@ act={ end, restart=function() resetGameData() - frame=90 + frame=30 end, insDown=function()if P.cy~=P.y_img then P.cy,P.lockDelay,P.spinLast=P.y_img,P.gameEnv.lock,false end end, insLeft=function() diff --git a/list.lua b/list.lua index 191469c9..93063ece 100644 --- a/list.lua +++ b/list.lua @@ -1,12 +1,14 @@ --[["four name" Techrash + Zestris + x Quadruple + x Tequeno + x Techzino + x Tectris + Techris + Techmino Tequéno - Zestris - Quadruple - Tequeno - Techzino - Tectris ]] PCbase={ {3,3,3,0,0,0,0,0,2,2}, @@ -66,10 +68,10 @@ attackColor={ gc.setColor(1,t,0) end, function(t) - gc.setColor(1,0,t) + gc.setColor(1,.3,.2+t*.8) end, function(t) - gc.setColor(t,t,1) + gc.setColor(.2+t*.8,.2+t*.8,1) end, }--3 animation-colorsets of attack buffer bar } @@ -132,6 +134,8 @@ bgm={ "push", "reason", "infinite", + "cruelty", + "final", } prevMenu={ @@ -142,7 +146,7 @@ prevMenu={ custom="mode", ready="mode", play=function() - gotoScene(gamemode~="custom"and"mode"or"custom") + gotoScene(gameMode~="custom"and"mode"or"custom") end, help="main", stat="main", @@ -154,33 +158,6 @@ prevMenu={ setting3="setting", } -modeID={ - "sprint","marathon","zen","infinite","solo","death","tsd","blind", - "pctrain","pcchallenge","techmino41","techmino99","gmroll","p2","p3","p4" -} -modeName={ - "Sprint","Marathon","Zen","Infinite","1v1","Death","TSD-only","Blind", - "PC Train","PC Challenge","Techmino41","Techmino99","GM roll","2P","3P","4P" -} -modeInfo={ - sprint="Clear 40 Lines", - marathon="Clear 200 Lines", - zen="Clear 200 Lines without gravity", - infinite="Infinite game,infinite happiness", - solo="Beat AI", - death="Survive under terrible speed", - tsd="T-spin-double Only!", - blind="Invisible board!", - pctrain="Let's learn some PCs", - pcchallenge="Make PCs in 100 Lines", - techmino41="Melee fight with 40 AIs", - techmino99="Melee fight with 98 AIs", - gmroll="Who want to be the grand master?", - p2="2 players game", - p3="3 players game", - p4="4 players game", -} - customID={ "drop", "lock", @@ -214,7 +191,7 @@ customVal={ fall=nil, next=nil, hold={"on","off"}, - sequence={"bag","his4","random"}, + sequence={"bag7","his4","random"}, visible={"normal","time","invisible"}, target={10,20,40,100,200,500,1000,"∞"}, freshLimit={0,8,15,"∞"}, @@ -246,11 +223,15 @@ testScore={[0]=0,[-1]=1,[-2]=0,[-3]=1,2,2,2} spin_n={"spin_1","spin_2","spin_3"} clear_n={"clear_1","clear_2","clear_3","clear_4"} ren_n={"ren_1","ren_2","ren_3","ren_4","ren_5","ren_6","ren_7","ren_8","ren_9","ren_10","ren_11"} +vibrateLevel={0,.02,.03,.04,.06,.08,.1} atkModeName={"Random","Badges","K.O.s","Counters"} up0to4={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} percent0to5={[0]="0%","20%","40%","60%","80%","100%",} +snapLevelName={"Free pos","Snap-10","Snap-20","Snap-40","Snap-60","Snap-80"} +snapLevelValue={1,10,20,40,60,80} reAtk={0,0,1,1,1,2,2,3,3} reDef={0,1,1,2,3,3,4,4,5} + marathon_drop={[0]=60,48,40,30,24,18,15,12,10,8,7,6,5,4,3,2,1,1,0,0} death_lock={12,11,10,9,8} death_wait={9,8,7,6,5} @@ -258,9 +239,383 @@ death_fall={10,9,8,7,6} pc_drop={50,45,40,35,30,26,22,18,15,12} pc_lock={55,50,45,40,36,32,30} pc_fall={18,16,14,12,10,9,8,7,6} -snapLevelName={"Free pos","Snap-10","Snap-20","Snap-40","Snap-60","Snap-80"} -snapLevelValue={1,10,20,40,60,80} +defaultModeEnv={ + sprint={ + { + drop=60, + target=10, + reach=Event.gameover.win, + }, + { + drop=60, + target=20, + reach=Event.gameover.win, + }, + { + drop=60, + target=40, + reach=Event.gameover.win, + }, + { + drop=60, + target=100, + reach=Event.gameover.win, + }, + { + drop=60, + target=400, + reach=Event.gameover.win, + }, + { + drop=60, + target=1000, + reach=Event.gameover.win, + }, + }, + marathon={ + { + drop=60, + fall=20, + target=10, + reach=Event.marathon_reach, + }, + { + _20G=true, + fall=20, + target=200, + reach=Event.marathon_reach, + }, + }, + zen={ + { + drop=1e99, + lock=1e99, + target=200, + reach=Event.gameover.win, + }, + }, + infinite={ + { + drop=1e99, + lock=1e99, + oncehold=false, + }, + }, + solo={ + {}, + }, + death={ + { + _20G=true, + drop=0, + lock=death_lock[1], + wait=death_wait[1], + fall=death_fall[1], + target=50, + reach=Event.death_reach, + arr=1, + }, + }, + tsd={ + { + oncehold=false, + drop=1e99, + lock=1e99, + target=1, + reach=Event.tsd_reach, + }, + { + drop=60, + lock=60, + target=1, + reach=Event.tsd_reach, + }, + }, + blind={ + { + drop=1e99, + lock=1e99, + visible=0, + }, + { + drop=15, + lock=30, + visible=0, + freshLimit=10, + }, + { + _20G=true, + lock=60, + visible=0, + freshLimit=15, + }, + }, + sudden={ + { + oncehold=false, + drop=1e99, + lock=1e99, + target=0, + reach=Event.sudden_reach, + }, + { + drop=30, + lock=60, + target=0, + reach=Event.sudden_reach, + }, + { + drop=15, + lock=60, + target=0, + reach=Event.sudden_reach_HARD, + }, + { + drop=5, + lock=20, + target=0, + reach=Event.sudden_reach_HARD, + }, + }, + pctrain={ + { + next=4, + hold=false, + drop=120, + lock=120, + fall=20, + sequence=4, + target=0, + freshLimit=1e99, + reach=Event.newPC, + }, + { + next=4, + hold=false, + drop=60, + lock=60, + fall=15, + sequence=4, + target=0, + reach=Event.newPC, + }, + }, + pcchallenge={ + { + oncehold=false, + drop=300, + lock=1e99, + sequence=1, + target=100, + reach=Event.gameover.win, + freshLimit=1e99, + }, + { + drop=60, + lock=120, + fall=10, + sequence=1, + target=100, + reach=Event.gameover.win, + }, + { + drop=20, + lock=60, + fall=20, + sequence=1, + target=100, + reach=Event.gameover.win, + }, + }, + techmino41={ + { + fall=20, + royaleMode=true, + royalePowerup={2,5,10,20}, + royaleRemain={30,20,15,10,5}, + }, + }, + techmino99={ + { + fall=20, + royaleMode=true, + royalePowerup={2,6,14,30}, + royaleRemain={75,50,35,20,10}, + }, + }, + drought={ + { + drop=20, + lock=30, + sequence=5, + target=100, + reach=Event.gameover.win, + }, + { + drop=20, + lock=30, + sequence=6, + target=100, + reach=Event.gameover.win, + }, + }, + gmroll={ + { + drop=0, + lock=15, + wait=10, + fall=15, + _20G=true, + visible=0, + arr=1, + }, + }, + p2={ + {}, + }, + p3={ + {}, + }, + p4={ + {}, + }, + custom={ + { + reach=Event.gameover.win + }, + }, +} +modeLevel={ + sprint={"10L","20L","40L","100L","400L","1000L"}, + marathon={"NORMAL","LUNATIC"}, + zen={"NORMAL"}, + infinite={"NORMAL"}, + solo={"EASY","NORMAL","HARD","LUNATIC"}, + death={"LUNATIC"}, + tsd={"NORMAL","HARD"}, + blind={"EASY","HARD","LUNATIC"}, + sudden={"EASY","NORMAL","HARD","LUNATIC"}, + pctrain={"HARD","LUNATIC"}, + pcchallenge={"NORMAL","HARD","LUNATIC"}, + techmino41={"EASY","NORMAL","HARD","LUNATIC","HELL"}, + techmino99={"EASY","NORMAL","HARD","LUNATIC","HELL"}, + drought={"NORMAL","MESS"}, + gmroll={"GM"}, + p2={"NORMAL"}, + p3={"NORMAL"}, + p4={"NORMAL"}, +} +modeLevelColor={ + EASY=color.cyan, + NORMAL=color.green, + HARD=color.purple, + LUNATIC=color.red, + EXTRA=color.lightPurple, + + MESS=color.lightGrey, + GM=color.blue, + HELL=color.grey, + ["10L"]=color.cyan, + ["20L"]=color.lightBlue, + ["40L"]=color.green, + ["100L"]=color.orange, + ["400L"]=color.red, + ["1000L"]=color.darkRed, +} +modeID={ + "sprint","marathon","zen","infinite","solo","death","tsd","blind","sudden", + "pctrain","pcchallenge","techmino41","techmino99","drought","gmroll","p2","p3","p4" +} +modeName={ + "Sprint","Marathon","Zen","Infinite","1v1","Death","TSD-only","Blind","Sudden", + "PC Train","PC Challenge","Techmino41","Techmino99","Drought","GM roll","2P","3P","4P" +} +modeInfo={ + sprint="Speed run.", + marathon="Clear 200 Lines", + zen="Clear 200 Lines without gravity", + infinite="Infinite game,infinite happiness", + solo="Beat AI", + death="Survive under terrible speed", + tsd="try to make 20 T-spin-double", + blind="Invisible board", + sudden="Try to survive", + pctrain="Let's learn some PCs", + pcchallenge="Make PCs in 100 Lines", + techmino41="Melee fight with 40 AIs", + techmino99="Melee fight with 98 AIs", + drought="ERRSEQ flood attack", + gmroll="Who want to be the grand master?", + p2="2 players game", + p3="3 players game", + p4="4 players game", +} + +freshMethod={ + function() + P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) + if #P.nxt<6 then + local bag={1,2,3,4,5,6,7} + for i=1,7 do + ins(P.nxt,rem(bag,rnd(8-i))) + ins(P.nb,blocks[P.nxt[#P.nxt]][0]) + end + end + end, + function() + P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) + local i,j=nil,0 + repeat + i,j=rnd(7),j+1 + until not(i==P.his[1]or i==P.his[2]or i==P.his[3]or i==P.his[4]) + P.nxt[6],P.nb[6]=i,blocks[i][0] + rem(P.his,1)ins(P.his,i) + end, + function() + P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) + repeat i=rnd(7)until i~=P.nxt[5] + P.nxt[6],P.nb[6]=i,blocks[i][0] + end, + function() + P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) + if P.cstat.piece%4==0 then + local r=rnd(#PClist) + local P=players[1] + local f=P.cstat.pc%2==0 + for i=1,4 do + local b=PClist[r][i] + if f then + if b<3 then b=3-b + elseif b<5 then b=7-b + end + end + ins(P.nxt,b) + ins(P.nb,blocks[b][0]) + end + end + end, + function() + P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) + if #P.nxt<6 then + local bag={1,2,3,4,5,6} + for i=1,6 do + ins(P.nxt,rem(bag,rnd(7-i))) + ins(P.nb,blocks[P.nxt[#P.nxt]][0]) + end + end + end, + function() + P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) + if #P.nxt<6 then + local bag={1,1,1,2,2,2,3,3,3,4,4,4,6,6,6,5,7} + repeat + ins(P.nxt,rem(bag,rnd(#bag))) + ins(P.nb,blocks[P.nxt[#P.nxt]][0]) + until not bag[1] + end + end, +} blocks={ {[0]={{0,1,1},{1,1,0}},{{1,0},{1,1},{0,1}},{{0,1,1},{1,1,0}},{{1,0},{1,1},{0,1}}}, {[0]={{1,1,0},{0,1,1}},{{0,1},{1,1},{1,0}},{{1,1,0},{0,1,1}},{{0,1},{1,1},{1,0}}}, @@ -342,46 +697,56 @@ Buttons={ load={}, intro={}, main={ - {x=250,y=300,w=330,h=60,rgb=color.red,t="Play",code=function()gotoScene("mode")end,down=2}, - {x=250,y=380,w=330,h=60,rgb=color.blue,t="Settings",code=function()gotoScene("setting")end,up=1,down=3}, - {x=165,y=460,w=160,h=60,rgb=color.yellow,t="Help",code=function()gotoScene("help")end,up=2,down=5,right=4}, - {x=335,y=460,w=160,h=60,rgb=color.cyan,t="Statistics",code=function()gotoScene("stat")end,up=2,down=5,left=3}, - {x=250,y=540,w=330,h=60,rgb=color.grey,t="Quit",code=back,up=3}, + {x=250,y=250,w=350,h=100,rgb=color.red,f=55,t="Play",code=function()gotoScene("mode")end,down=2}, + {x=250,y=360,w=350,h=100,rgb=color.blue,f=50,t="Settings",code=function()gotoScene("setting")end,up=1,down=3}, + {x=160,y=470,w=170,h=100,rgb=color.yellow,f=50,t="Help",code=function()gotoScene("help")end,up=2,down=5,right=4}, + {x=340,y=470,w=170,h=100,rgb=color.cyan,f=40,t="Statistics",code=function()gotoScene("stat")end,up=2,down=5,left=3}, + {x=250,y=580,w=350,h=100,rgb=color.grey,f=40,t="Quit",code=back,up=3}, }, mode={ - {x=1000,y=210,w=200,h=140,rgb=color.white,t="Λ",f=64,code=function()if modeSel>1 then modeSel=modeSel-1 end end}, - {x=1000,y=430,w=200,h=140,rgb=color.white,t="v",f=80,code=function()if modeSel<#modeID then modeSel=modeSel+1 end end}, - {x=1000,y=600,w=180,h=80,rgb=color.green,t="Start",code=function()startGame(modeID[modeSel])end}, - {x=400,y=150,w=180,h=80,rgb=color.yellow,t="Custom(c)",code=function()gotoScene("custom")end}, - {x=640,y=630,w=180,h=60,rgb=color.white,t="Back",code=back}, + {x=1000,y=210,w=200,h=140,rgb=color.white,hide=function()return modeSel==1 end,t="Λ",f=64,code=function()keyDown.mode("up")end}, + {x=1000,y=430,w=200,h=140,rgb=color.white,hide=function()return modeSel==#modeID end,t="v",f=80,code=function()keyDown.mode("down")end}, + {x=190,y=160,w=100,h=80,rgb=color.white,hide=function()return levelSel==1 end,t="<",code=function()keyDown.mode("left")end}, + {x=350,y=160,w=100,h=80,rgb=color.white,hide=function()return levelSel==#modeLevel[modeID[modeSel]] end,t=">",code=function()keyDown.mode("right")end}, + {x=1000,y=600,w=250,h=100,rgb=color.green,f=50,t="Start",code=function()loadGame(modeID[modeSel],levelSel)end}, + {x=270,y=540,w=190,h=85,rgb=color.yellow,t="Custom(c)",code=function()gotoScene("custom")end}, + {x=640,y=630,w=230,h=90,rgb=color.white,f=45,t="Back",code=back}, }, custom={ {x=1000,y=200,w=100,h=100,rgb=color.white,t="Λ",f=40,code=function()optSel=(optSel-2)%#customID+1 end}, {x=1000,y=440,w=100,h=100,rgb=color.white,t="v",f=50,code=function()optSel=optSel%#customID+1 end}, {x=880,y=320,w=100,h=100,rgb=color.white,t="<",f=50,code=function()local k=customID[optSel]customSel[k]=(customSel[k]-2)%#customRange[k]+1 end}, {x=1120,y=320,w=100,h=100,rgb=color.white,t=">",f=50,code=function()local k=customID[optSel]customSel[k]=customSel[k]%#customRange[k]+1 end}, - {x=1000,y=580,w=180,h=80,rgb=color.green,t="Start",code=function()startGame("custom")end}, + {x=1000,y=580,w=180,h=80,rgb=color.green,t="Start",code=function()loadGame("custom",levelSel)end}, {x=640,y=630,w=180,h=60,rgb=color.white,t="Back",code=back}, }, play={ }, setting={--Normal setting - {x=330,y=100,w=200,h=60,rgb=color.white,t=function()return setting.ghost and"Ghost ON"or"Ghost OFF"end,code=function()setting.ghost=not setting.ghost end,down=3,right=2}, - {x=540,y=100,w=200,h=60,rgb=color.white,t=function()return setting.center and"Center ON"or"Center OFF"end,code=function()setting.center=not setting.center end,down=5,left=1,right=11}, + {x=285,y=90,w=210,h=60,rgb=color.white,t=function()return setting.ghost and"Ghost ON"or"Ghost OFF"end,code=function()setting.ghost=not setting.ghost end,down=3,right=2}, + {x=505,y=90,w=210,h=60,rgb=color.white,t=function()return setting.center and"Center ON"or"Center OFF"end,code=function()setting.center=not setting.center end,down=5,left=1,right=11}, --1,2 - {x=245,y=180,w=40,h=40,rgb=color.white,t="-",code=function()setting.das=(setting.das-1)%31 end,up=1,down=7,right=4}, - {x=410,y=180,w=40,h=40,rgb=color.white,t="+",code=function()setting.das=(setting.das+1)%31 end,up=1,down=8,left=3,right=5}, - {x=460,y=180,w=40,h=40,rgb=color.white,t="-",code=function()setting.arr=(setting.arr-1)%16 end,up=2,down=9,left=4,right=6}, - {x=625,y=180,w=40,h=40,rgb=color.white,t="+",code=function()setting.arr=(setting.arr+1)%16 end,up=2,down=10,left=5,right=13}, + {x=205,y=180,w=50,h=50,rgb=color.white,t="-",code=function()setting.das=(setting.das-1)%31 end,up=1,down=7,right=4}, + {x=370,y=180,w=50,h=50,rgb=color.white,t="+",code=function()setting.das=(setting.das+1)%31 end,up=1,down=8,left=3,right=5}, + {x=420,y=180,w=50,h=50,rgb=color.white,t="-",code=function()setting.arr=(setting.arr-1)%16 end,up=2,down=9,left=4,right=6}, + {x=585,y=180,w=50,h=50,rgb=color.white,t="+",code=function()setting.arr=(setting.arr+1)%16 end,up=2,down=10,left=5,right=13}, --3~6 - {x=245,y=260,w=40,h=40,rgb=color.white,t="-",code=function()setting.sddas=(setting.sddas-1)%11 end,up=3,down=17,right=8}, - {x=410,y=260,w=40,h=40,rgb=color.white,t="+",code=function()setting.sddas=(setting.sddas+1)%11 end,up=4,down=17,left=7,right=9}, - {x=460,y=260,w=40,h=40,rgb=color.white,t="-",code=function()setting.sdarr=(setting.sdarr-1)%6 end,up=5,down=17,left=8,right=10}, - {x=625,y=260,w=40,h=40,rgb=color.white,t="+",code=function()setting.sdarr=(setting.sdarr+1)%4 end,up=6,down=17,left=9,right=14}, + {x=205,y=260,w=50,h=50,rgb=color.white,t="-",code=function()setting.sddas=(setting.sddas-1)%11 end,up=3,down=13,right=8}, + {x=370,y=260,w=50,h=50,rgb=color.white,t="+",code=function()setting.sddas=(setting.sddas+1)%11 end,up=4,down=13,left=7,right=9}, + {x=420,y=260,w=50,h=50,rgb=color.white,t="-",code=function()setting.sdarr=(setting.sdarr-1)%4 end,up=5,down=13,left=8,right=10}, + {x=585,y=260,w=50,h=50,rgb=color.white,t="+",code=function()setting.sdarr=(setting.sdarr+1)%4 end,up=6,down=13,left=9,right=14}, --7~10 - {x=870-90,y=100,w=160,h=60,rgb=color.white,t=function()return setting.sfx and"SFX:on"or"SFX:off"end,code=function()setting.sfx=not setting.sfx end,down=13,left=2,right=12}, - {x=870+90,y=100,w=160,h=60,rgb=color.white,t=function()return setting.bgm and"BGM:on"or"BGM:off"end,code=function()BGM()setting.bgm=not setting.bgm;BGM("blank")end,down=13,left=11}, - {x=870,y=180,w=340,h=60,rgb=color.white,t=function()return setting.fullscreen and"Fullscreen:on"or"Fullscreen:off"end, + {x=760,y=90,w=160,h=60,rgb=color.white,t=function()return setting.sfx and"SFX:on"or"SFX:off"end,code=function()setting.sfx=not setting.sfx end,down=13,left=2,right=12}, + {x=940,y=90,w=160,h=60,rgb=color.white,t=function()return setting.bgm and"BGM:on"or"BGM:off"end,code=function() + BGM() + setting.bgm=not setting.bgm + BGM("blank") + end,down=13,left=6}, + {x=850,y=160,w=340,h=60,rgb=color.white,t=function()return "Vibrate level:"..setting.vib end,code=function() + setting.vib=(setting.vib+1)%5 + VIB(2) + end,up=11,down=14,left=6}, + {x=850,y=230,w=340,h=60,rgb=color.white,t=function()return setting.fullscreen and"Fullscreen:on"or"Fullscreen:off"end, code=function() setting.fullscreen=not setting.fullscreen love.window.setFullscreen(setting.fullscreen) @@ -389,9 +754,9 @@ Buttons={ love.resize(gc.getWidth(),gc.getHeight()) end end, - up=11,down=14,left=6 + up=13,down=15,left=6 }, - {x=870,y=260,w=340,h=60,rgb=color.white,t=function()return setting.bgblock and"BG animation:on"or"BG animation:off"end, + {x=850,y=300,w=340,h=60,rgb=color.white,t=function()return setting.bgblock and"BG animation:on"or"BG animation:off"end, code=function() setting.bgblock=not setting.bgblock if not setting.bgblock then @@ -400,18 +765,17 @@ Buttons={ end end end, - up=12,down=15,left=10 + up=14,down=16,left=10 }, - - --11~14 - {x=870,y=340,w=340,h=60,rgb=color.white,t=function()return"frameDraw:"..setting.frameMul.."%"end,code=function() + {x=850,y=370,w=340,h=60,rgb=color.white,t=function()return"frameDraw:"..setting.frameMul.."%"end,code=function() setting.frameMul=setting.frameMul+(setting.frameMul<50 and 5 or 10) if setting.frameMul>100 then setting.frameMul=25 end - end,up=14,down=16}, - {x=870,y=420,w=340,h=60,rgb=color.green,t="Control settings",code=function()gotoScene("setting2")end,up=15,down=17}, - {x=870,y=500,w=340,h=60,rgb=color.yellow,t="Touch settings",code=function()gotoScene("setting3")end,up=16,down=18}, - {x=640,y=640,w=210,h=60,rgb=color.white,t="Save&Back",code=back,up=17}, - --15~18 + end,up=15,down=17}, + --11~16 + {x=850,y=440,w=340,h=60,rgb=color.green,t="Control settings",code=function()gotoScene("setting2")end,up=16,down=18}, + {x=850,y=510,w=340,h=60,rgb=color.yellow,t="Touch settings",code=function()gotoScene("setting3")end,up=17,down=19}, + {x=640,y=620,w=300,h=70,rgb=color.white,t="Save&Back",code=back,up=18}, + --17~19 }, setting2={--Control setting {x=840,y=630,w=180,h=60,rgb=color.white,t="Back",code=back}, @@ -421,11 +785,12 @@ Buttons={ {x=640,y=210,w=500,h=80,t=function()return setting.virtualkeySwitch and"Hide Virtual Key"or"Show Virtual Key"end,code=function() setting.virtualkeySwitch=not setting.virtualkeySwitch end}, - {x=450,y=310,w=170,h=80,t="Reset",code=function() + {x=450,y=310,w=170,h=80,t="Defaults",code=function() for K=1,#virtualkey do - local b,b0=virtualkey[K],gameEnv0.virtualkey[K] + local b,b0=virtualkey[K],virtualkeySet[defaultSel][K] b[1],b[2],b[3],b[4]=b0[1],b0[2],b0[3],b0[4] - end--Reset virtualkey + end--Default virtualkey + defaultSel=defaultSel%5+1 end}, {x=640,y=310,w=170,h=80,t=function()return snapLevelName[snapLevel]end,code=function() snapLevel=snapLevel%6+1 @@ -479,9 +844,78 @@ virtualkey={ {x=0,y=0,r=0},--toDown ]] } +virtualkeySet={ + { + {80,720-200,6400,80},--moveLeft + {320,720-200,6400,80},--moveRight + {1280-80,720-200,6400,80},--rotRight + {1280-200,720-80,6400,80},--rotLeft + {1280-200,720-320,6400,80},--rotFlip + {200,720-320,6400,80},--hardDrop + {200,720-80,6400,80},--softDrop + {1280-320,720-200,6400,80},--hold + {1280-80,280,6400,80},--swap + {80,280,6400,80},--restart + },--Farter's set 3 + { + {1280-320,720-200,6400,80},--moveLeft + {1280-80,720-200,6400,80},--moveRight + {200,720-80,6400,80},--rotRight + {80,720-200,6400,80},--rotLeft + {200,720-320,6400,80},--rotFlip + {1280-200,720-320,6400,80},--hardDrop + {1280-200,720-80,6400,80},--softDrop + {320,720-200,6400,80},--hold + {80,280,6400,80},--swap + {1280-80,280,6400,80},--restart + },--Mirrored farter's set 3 + { + {80,720-80,6400,80},--moveLeft + {240,720-80,6400,80},--moveRight + {1280-240,720-80,6400,80},--rotRight + {1280-400,720-80,6400,80},--rotLeft + {1280-240,720-240,6400,80},--rotFlip + {1280-80,720-80,6400,80},--hardDrop + {1280-80,720-240,6400,80},--softDrop + {1280-80,720-400,6400,80},--hold + {80,360,6400,80},--swap + {80,80,6400,80},--restart + },--Author's set + { + {1280-400,720-80,6400,80},--moveLeft + {1280-80,720-80,6400,80},--moveRight + {240,720-80,6400,80},--rotRight + {80,720-80,6400,80},--rotLeft + {240,720-240,6400,80},--rotFlip + {1280-240,720-240,6400,80},--hardDrop + {1280-240,720-80,6400,80},--softDrop + {1280-80,720-240,6400,80},--hold + {80,720-240,6400,80},--swap + {80,320,6400,80},--restart + },--Keyboard set + { + {1280-360,40,1600,40},--moveLeft + {1280-280,40,1600,40},--moveRight + {1280-520,40,1600,40},--rotRight + {1280-600,40,1600,40},--rotLeft + {1280-440,40,1600,40},--rotFlip + {1280-40,40,1600,40},--hardDrop + {1280-120,40,1600,40},--softDrop + {1280-200,40,1600,40},--hold + {1280-680,40,1600,40},--swap + {-10,-10,0,0},--restart + },--PC key feedback +} Text={ load={"Loading textures","Loading BGM","Loading SFX","Finished",}, + tips={ + "The whole game is made by MrZ!", + "Back to Back 8 combo Techrash PC!", + "Techmino has a Nspire-CX edition!", + "Is B2B2B2B possible?", + "MrZ spin Penta!", + }, stat={ "Games run:", "Games played:", diff --git a/main.lua b/main.lua index ca935b13..ce3760ee 100644 --- a/main.lua +++ b/main.lua @@ -25,7 +25,7 @@ system=sys.getOS() touching=nil--1st touching ID scene="" -gamemode="" +gameMode="" bgmPlaying=nil curBG="none" BGblock={ct=150,next=7} @@ -40,7 +40,7 @@ function setFont(s) if Fonts[s]then gc.setFont(Fonts[s]) else - local t=gc.setNewFont("siyuanhei.otf",s-5) + local t=gc.setNewFont("albbph.ttf",s-5) Fonts[s]=t gc.setFont(t) end @@ -57,19 +57,8 @@ gameEnv0={ next=6,hold=true,oncehold=true, sequence=1,visible=1, _20G=false,target=1e99, - freshLimit=1e99, - virtualkey={ - {80,720-80,6400,80},--moveLeft - {240,720-80,6400,80},--moveRight - {1280-240,720-80,6400,80},--rotRight - {1280-400,720-80,6400,80},--rotLeft - {1280-240,720-240,6400,80},--rotFlip - {1280-80,720-80,6400,80},--hardDrop - {1280-80,720-240,6400,80},--softDrop - {1280-80,720-400,6400,80},--hold - {80,360,6400,80},--swap - {80,80,6400,80},--restart - }, + freshLimit=15, + virtualkey={}, reach=null, --not all is actually used,some only provide a key } @@ -86,160 +75,54 @@ customSel={ freshLimit=3, opponent=1, } -freshMethod={ - function() - P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) - if #P.nxt<6 then - local bag={1,2,3,4,5,6,7} - for i=1,7 do - ins(P.nxt,rem(bag,rnd(8-i))) - ins(P.nb,blocks[P.nxt[#P.nxt]][0]) - end - end - end, - function() - P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) - local i,j=nil,0 - repeat - i,j=rnd(7),j+1 - until not(i==P.his[1]or i==P.his[2]or i==P.his[3]or i==P.his[4]) - P.nxt[6],P.nb[6]=i,blocks[i][0] - rem(P.his,1)ins(P.his,i) - end, - function() - P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) - repeat i=rnd(7)until i~=P.nxt[5] - P.nxt[6],P.nb[6]=i,blocks[i][0] - end, - function() - P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) - if #P.nxt<6 then - local bag={1,1,2,2,3,3,4,4,5,5,5,6,6,7,7} - repeat - local i=rem(bag,rnd(#bag)) - ins(P.nxt,i) - ins(P.nb,blocks[i][0]) - until #bag==0 - end - end, - function() - P.bn,P.cb=rem(P.nxt,1),rem(P.nb,1) - if P.cstat.piece%4==0 then - local r=rnd(#PClist) - local P=players[1] - local f=P.cstat.pc%2==0 - for i=1,4 do - local b=PClist[r][i] - if f then - if b<3 then b=3-b - elseif b<5 then b=7-b - end - end - ins(P.nxt,b) - ins(P.nb,blocks[b][0]) - end - end - end, -} loadmode={ sprint=function() - modeEnv={ - drop=60, - target=40, - reach=Event.gameover.win, - } createPlayer(1,340,15) curBG="game1" BGM("race") end, + marathon=function() + createPlayer(1,340,15) + curBG="strap" + BGM("way") + end, zen=function() - modeEnv={ - drop=1e99, - lock=1e99, - target=200, - reach=Event.gameover.win, - } createPlayer(1,340,15) curBG="strap" BGM("infinite") end, infinite=function() - modeEnv={ - drop=1e99, - lock=1e99, - } createPlayer(1,340,15) curBG="glow" BGM("infinite") end, - gmroll=function() - modeEnv={ - drop=0, - lock=15, - wait=10, - fall=15, - _20G=true, - visible=0, - freshLimit=15, - arr=1, - } - createPlayer(1,340,15) - curBG="glow" - BGM("push") - end, - marathon=function() - modeEnv={ - drop=60, - fall=20, - target=10, - reach=Event.marathon_reach, - freshLimit=15, - } - createPlayer(1,340,15) - curBG="strap" - BGM("way") + solo=function() + createPlayer(1,20,15)--Player + createPlayer(2,660,85,.9,customRange.opponent[3*gameLevel])--AI + curBG="game2" + BGM("race") end, death=function() - modeEnv={ - _20G=true, - drop=0, - lock=death_lock[1], - wait=death_wait[1], - fall=death_fall[1], - target=50, - reach=Event.death_reach, - freshLimit=15, - arr=1, - } createPlayer(1,340,15) curBG="game2" BGM("push") end, tsd=function() - modeEnv={ - drop=60, - lock=60, - sequence=4, - target=1, - reach=Event.tsd_reach, - freshLimit=15, - } createPlayer(1,340,15) curBG="matrix" BGM("infinite") end, + blind=function() + createPlayer(1,340,15) + curBG="glow" + BGM("push") + end, + sudden=function() + createPlayer(1,340,15) + curBG="matrix" + BGM("way") + end, pctrain=function() - modeEnv={ - next=4, - hold=false, - drop=60, - lock=60, - fall=20, - sequence=5, - target=0, - reach=Event.newPC, - freshLimit=15, - } createPlayer(1,340,15) local r=rnd(#PClist) local P=players[1] @@ -253,39 +136,34 @@ loadmode={ BGM("infinite") end, pcchallenge=function() - modeEnv={ - oncehold=false, - drop=300, - lock=1e99, - fall=20, - sequence=1, - target=100, - reach=Event.gameover.win, - freshLimit=1e99, - } createPlayer(1,340,15) curBG="matrix" BGM("infinite") end, techmino41=function() - modeEnv={ - freshLimit=15, - fall=20, - royaleMode=true, - royale={2,5,10,20}, - } createPlayer(1,340,15)--Player - - local n=2 + if gameLevel==5 then players[1].gameEnv.drop=15 end + local n,min,max=2 + if gameLevel==1 then + min,max=5,30 + elseif gameLevel==2 then + min,max=3,25 + elseif gameLevel==3 then + min,max=2,20 + elseif gameLevel==4 then + min,max=2,10 + elseif gameLevel==5 then + min,max=1,6 + end for i=1,4 do for j=1,5 do - createPlayer(n,77*i-55,140*j-125,.2,rnd(15)) + createPlayer(n,77*i-55,140*j-125,.2,rnd(min,max)) n=n+1 end end for i=9,12 do for j=1,5 do - createPlayer(n,77*i+275,140*j-125,.2,rnd(15)) + createPlayer(n,77*i+275,140*j-125,.2,rnd(min,max)) n=n+1 end end--AIs @@ -294,24 +172,29 @@ loadmode={ BGM("race") end, techmino99=function() - modeEnv={ - freshLimit=15, - fall=20, - royaleMode=true, - royale={2,6,14,30}, - } createPlayer(1,340,15)--Player - - local n=2 + if gameLevel==5 then players[1].gameEnv.drop=15 end + local n,min,max=2 + if gameLevel==1 then + min,max=5,32 + elseif gameLevel==2 then + min,max=3,25 + elseif gameLevel==3 then + min,max=2,18 + elseif gameLevel==4 then + min,max=2,12 + elseif gameLevel==5 then + min,max=1,12 + end for i=1,7 do for j=1,7 do - createPlayer(n,46*i-36,97*j-72,.135,rnd()<.1 and rnd(6)or rnd(10,30)) + createPlayer(n,46*i-36,97*j-72,.135,rnd(min,max)) n=n+1 end end for i=15,21 do for j=1,7 do - createPlayer(n,46*i+264,97*j-72,.135,rnd()<.1 and rnd(6)or rnd(10,30)) + createPlayer(n,46*i+264,97*j-72,.135,rnd(min,max)) n=n+1 end end--AIs @@ -319,32 +202,17 @@ loadmode={ curBG="game3" BGM("race") end, - solo=function() - modeEnv={ - freshLimit=15, - } - createPlayer(1,20,15)--Player - createPlayer(2,660,85,.9,1)--AI - - curBG="game2" - BGM("race") - end, - blind=function() - modeEnv={ - drop=15, - lock=30, - visible=0, - freshLimit=10, - } + drought=function() + createPlayer(1,340,15) + curBG="strap" + BGM("reason") + end, + gmroll=function() createPlayer(1,340,15) - curBG="glow" BGM("push") end, p2=function() - modeEnv={ - freshLimit=15, - } createPlayer(1,20,15) createPlayer(2,650,15) @@ -352,9 +220,6 @@ loadmode={ BGM("way") end, p3=function() - modeEnv={ - freshLimit=15, - } createPlayer(1,20,100,.65) createPlayer(2,435,100,.65) createPlayer(3,850,100,.65) @@ -363,9 +228,6 @@ loadmode={ BGM("way") end, p4=function() - modeEnv={ - freshLimit=15, - } createPlayer(1,25,150,.5) createPlayer(2,335,150,.5) createPlayer(3,645,150,.5) @@ -375,7 +237,7 @@ loadmode={ BGM("way") end, custom=function() - modeEnv={reach=Event.gameover.win} + modeEnv={} for i=1,#customID do local k=customID[i] modeEnv[k]=customRange[k][customSel[k]] @@ -393,10 +255,10 @@ loadmode={ end, } mesDisp={ - --Default:font=40,white + --Default:font=35,white sprint=function() - setFont(75) - mStr(max(40-P.cstat.row,0),-75,280) + setFont(70) + mStr(max(P.gameEnv.target-P.cstat.row,0),-75,260) end, zen=function() setFont(75) @@ -404,51 +266,47 @@ mesDisp={ end, infinite=function() setFont(50) - mStr(P.cstat.atk,-75,320) - mStr(format("%.2f",2.5*P.cstat.atk/P.cstat.piece),-75,430) + mStr(P.cstat.atk,-75,310) + mStr(format("%.2f",2.5*P.cstat.atk/P.cstat.piece),-75,420) setFont(20) - gc.print("Attack",-100,360) - gc.print("Efficiency",-108,472) - end, - solo=function() - setFont(50) - mStr(P.cstat.atk,-75,320) - setFont(20) - gc.print("Attack",-100,360) - end, - gmroll=function() - setFont(25) - gc.print("Techrash",-120,420) - setFont(80) - mStr(P.cstat.techrash,-75,350) + gc.print("Attack",-98,363) + gc.print("Efficiency",-110,475) end, marathon=function() setFont(50) - mStr(P.cstat.row,-75,330) - mStr(P.gameEnv.target,-75,380) + mStr(P.cstat.row,-75,320) + mStr(P.gameEnv.target,-75,370) gc.rectangle("fill",-120,376,90,4) end, death=function() setFont(50) - mStr(P.cstat.row,-75,330) - mStr(P.gameEnv.target,-75,380) + mStr(P.cstat.row,-75,320) + mStr(P.gameEnv.target,-75,370) gc.rectangle("fill",-120,376,90,4) end, tsd=function() setFont(35) - gc.print("TSD",-105,405) + gc.print("TSD",-102,405) setFont(80) mStr((P.gameEnv.target-1)*.5,-75,330) end, + blind=function() + setFont(25) + gc.print("Rows",-102,300) + gc.print("Techrash",-123,420) + setFont(80) + mStr(P.cstat.row,-75,220) + mStr(P.cstat.techrash,-75,340) + end, pctrain=function() setFont(25) - gc.print("Perfect Clear",-138,400) + gc.print("Perfect Clear",-140,410) setFont(80) mStr(P.cstat.pc,-75,330) end, pcchallenge=function() setFont(25) - gc.print("Perfect Clear",-138,420) + gc.print("Perfect Clear",-140,430) setFont(80) mStr(P.cstat.pc,-75,350) setFont(50) @@ -456,37 +314,43 @@ mesDisp={ end, techmino41=function() setFont(40) - mStr(#players.alive.."/41",-80,180) - mStr(P.ko,-65,220) + mStr(#players.alive.."/41",-75,175) + mStr(P.ko,-60,215) setFont(25) - gc.print("KO",-120,229) - gc.print(P.badge,-40,233) + gc.print("KO",-115,225) + gc.setColor(1,.5,0,.6) + gc.print(P.badge,-35,227) + gc.setColor(1,1,1) setFont(30) - gc.print(up0to4[P.strength],-125,295) + gc.print(up0to4[P.strength],-125,290) for i=1,P.strength do gc.draw(badgeIcon,16*i-130,260) end end, techmino99=function() setFont(40) - mStr(#players.alive.."/99",-80,180) - mStr(P.ko,-65,220) + mStr(#players.alive.."/99",-75,175) + mStr(P.ko,-60,215) setFont(25) - gc.print("KO",-120,229) - gc.print(P.badge,-40,233) + gc.print("KO",-115,225) + gc.setColor(1,.5,0,.6) + gc.print(P.badge,-35,227) + gc.setColor(1,1,1) setFont(30) - gc.print(up0to4[P.strength],-125,295) + gc.print(up0to4[P.strength],-125,290) for i=1,P.strength do gc.draw(badgeIcon,16*i-130,260) end end, - blind=function() + drought=function() + setFont(75) + mStr(max(100-P.cstat.row,0),-75,280) + end, + gmroll=function() setFont(25) - gc.print("Rows",-100,300) - gc.print("Techrash",-120,420) + gc.print("Techrash",-123,420) setFont(80) - mStr(P.cstat.row,-75,230) - mStr(P.cstat.techrash,-75,350) + mStr(P.cstat.techrash,-75,340) end, custom=function() if P.gameEnv.target<1e4 then @@ -502,15 +366,19 @@ Event={ P.control=false P.timing=false P.waiting=1e99 - P.atking=nil P.b2b=0 P.result="WIN" + changeAtk(P) + for i=1,#P.atkBuffer do + P.atkBuffer[i].sent=true + P.atkBuffer[i].time=0 + end for i=1,#P.field do for j=1,10 do P.visTime[i][j]=min(P.visTime[i][j],20) end end - showText("WIN","appear",100,nil,true) + showText(P,"WIN","appear",90,nil,nil,true) if P.id==1 and players[2]and players[2].ai then SFX("win")end ins(P.task,Event.task.win) end, @@ -519,35 +387,40 @@ Event={ P.control=false P.timing=false P.waiting=1e99 - P.atking=nil P.b2b=0 - P.result=" K.O." - showText("LOSE","appear",100,nil,true) + P.result="K.O." + showText(P,"LOSE","appear",90,nil,nil,true) for i=1,#players.alive do if players.alive[i]==P then rem(players.alive,i) break end end + changeAtk(P) if modeEnv.royaleMode then + P.strength=0 if P.lastRecv and P.lastRecv.alive then - if P.lastRecv.id==1 then - throwBadge(P,P.lastRecv,P.badge) - end local A=P.lastRecv + if P.id==1 or A.id==1 then + throwBadge(P,A,P.badge) + P.killMark=A.id==1 + end A.ko,A.badge=A.ko+1,A.badge+P.badge+1 for i=A.strength+1,4 do - if A.badge>=modeEnv.royale[i]then + if A.badge>=modeEnv.royalePowerup[i]then A.strength=i end end end + freshRoyaleTarget() for i=1,#players.alive do if players.alive[i].atking==P then - players.alive[i].atking=nil + freshTarget(players.alive[i]) end end - freshRoyaleTarget() + if #players.alive==modeEnv.royaleRemain[gameStage]then + royaleLevelup() + end end for i=1,#P.atkBuffer do P.atkBuffer[i].sent=true @@ -585,15 +458,28 @@ Event={ P.gameEnv.lock=death_lock[t] P.gameEnv.wait=death_wait[t] P.gameEnv.fall=death_fall[t] - showText("STAGE "..t,"fly",80,-120) + showText(P,"STAGE "..t,"fly",80,-120) SFX("reach") end end, tsd_reach=function() - if not(#P.clearing==2 and P.bn==5 and P.spinLast)then + if P.lastClear~=52 then Event.gameover.lose() else P.gameEnv.target=P.gameEnv.target+2 + if #P.field>10 and P.gameEnv.target%10~=0 then + ins(P.clearing,1) + end + end + end, + sudden_reach=function() + if #P.clearing>0 and P.lastClear<10 then + Event.gameover.lose() + end + end, + sudden_reach_HARD=function() + if #P.clearing>0 and P.lastClear<10 and P.lastClear~=74 then + Event.gameover.lose() end end, newPC=function() @@ -601,15 +487,17 @@ Event={ if #P.field==#P.clearing then P.counter=P.cstat.piece==0 and 19 or 0 ins(P.task,Event.task.PC) - local s=P.cstat.pc*.5 - if int(s)==s and s>0 then - P.gameEnv.drop=pc_drop[s]or 10 - P.gameEnv.lock=pc_lock[s]or 20 - P.gameEnv.fall=pc_fall[s]or 5 - if s==10 then - showText("Max speed","appear",80,-120) - else - showText("Speed up","appear",30,-130) + if gameLevel==2 then + local s=P.cstat.pc*.5 + if int(s)==s and s>0 then + P.gameEnv.drop=pc_drop[s]or 10 + P.gameEnv.lock=pc_lock[s]or 20 + P.gameEnv.fall=pc_fall[s]or 5 + if s==10 then + showText(P,"Max speed","appear",80,-120) + else + showText(P,"Speed up","appear",30,-130) + end end end else @@ -624,18 +512,22 @@ Event={ win=function() P.counter=P.counter+1 if P.counter>80 then - for i=1,#P.field do - for j=1,10 do - if P.visTime[i][j]>0 then - P.visTime[i][j]=P.visTime[i][j]-1 + if P.gameEnv.visible==1 then + for i=1,#P.field do + for j=1,10 do + if P.visTime[i][j]>0 then + P.visTime[i][j]=P.visTime[i][j]-1 + end end end - end - if P.counter==100 then - for i=1,#P.field do - removeRow(P.field) - removeRow(P.visTime) + if P.counter==100 then + for i=1,#P.field do + removeRow(P.field) + removeRow(P.visTime) + end + return true end + elseif P.counter==100 then return true end end @@ -643,18 +535,22 @@ Event={ lose=function() P.counter=P.counter+1 if P.counter>80 then - for i=1,#P.field do - for j=1,10 do - if P.visTime[i][j]>0 then - P.visTime[i][j]=P.visTime[i][j]-1 + if P.gameEnv.visible==1 then + for i=1,#P.field do + for j=1,10 do + if P.visTime[i][j]>0 then + P.visTime[i][j]=P.visTime[i][j]-1 + end end end - end - if P.counter==100 then - for i=1,#P.field do - removeRow(P.field) - removeRow(P.visTime) + if P.counter==100 then + for i=1,#P.field do + removeRow(P.field) + removeRow(P.visTime) + end + return true end + elseif P.counter==100 then return true end end @@ -686,9 +582,8 @@ Event={ }, } --Game system Data - setting={ - sfx=true,bgm=true, + sfx=true,bgm=true,vib=3, fullscreen=false, bgblock=true, lang="eng", @@ -748,7 +643,6 @@ stat={ spin=0, } --User Data&User Setting ---------------------------------Wrning!_G __index Plyr[n] when chng any playr's val! require("toolfunc") require("gamefunc") require("list") diff --git a/paint.lua b/paint.lua index b1997c5d..ed7f7578 100644 --- a/paint.lua +++ b/paint.lua @@ -54,8 +54,8 @@ FX={ gc.push("transform") setFont(t.font) gc.translate(150,250+t.dy) - gc.setColor(1,1,1,a) if t.t<20 then gc.scale((20-t.t)*.015+1,1)end + gc.setColor(1,1,1,a) mStr(t.text,0,-t.font*.5) gc.pop() end, @@ -63,46 +63,63 @@ FX={ gc.push("transform") setFont(t.font) gc.translate(150,290+t.dy) - gc.setColor(1,1,1,a) if t.t<20 then gc.shear((20-t.t)*.05,0)end - mStr(t.text,0,-t.font*.5) + gc.setColor(1,1,1,a) + mStr(t.text,0,-t.font*.5-15) gc.pop() end, spin=function(t,a) gc.push("transform") setFont(t.font) gc.translate(150,250+t.dy) - gc.setColor(1,1,1,a) if t.t<20 then gc.rotate((20-t.t)^2*.0015) end - mStr(t.text,0,-t.font*.5) + gc.setColor(1,1,1,a) + mStr(t.text,0,-t.font*.5-8) gc.pop() end, flicker=function(t,a) setFont(t.font) gc.setColor(1,1,1,a*(rnd()+.5)) - mStr(t.text,150,250-t.font*.5+t.dy) + mStr(t.text,150,225-t.font*.5+t.dy) end, zoomout=function(t,a) gc.push("transform") setFont(t.font) - gc.translate(150,290+t.dy) - gc.setColor(1,1,1,a) local k=t.t^.5*.2+1 + gc.translate(150,290+t.dy) gc.scale(k,k) - mStr(t.text,0,-t.font*.5) + gc.setColor(1,1,1,a) + mStr(t.text,0,-t.font*.5-5) gc.pop() - end + end, + beat=function(t,a) + gc.push("transform") + setFont(t.font) + gc.translate(150,290+t.dy) + if t.t<20 then + local k=.2*(5+(25-t.t)^.5)-.5 + gc.scale(k,k) + end + gc.setColor(1,1,1,a) + mStr(t.text,0,-t.font*.5-5) + gc.pop() + end, } +function updateButton() + for i=1,#Buttons[scene]do + local B=Buttons[scene][i] + local t=i==Buttons.sel and .4 or 0 + B.alpha=abs(B.alpha-t)>.02 and(B.alpha+(B.alphat then B.alpha=B.alpha-.02 elseif B.alpha.02 and(B.alpha+(B.alphat then B.alpha=B.alpha-.02 elseif B.alpha=1 and i<=#modeID then local f=80-abs(i-modeSel)*20 gc.setColor(i==modeSel and color.white or abs(i-modeSel)==1 and color.grey or color.darkGrey) setFont(f) - mStr(modeName[i],640,320+70*(i-modeSel)-f*.5) + mStr(modeName[i],640,310+70*(i-modeSel)-f*.5) end end end @@ -303,11 +330,21 @@ function Pnt.play() gc.setStencilTest()--In-playField mask gc.translate(0,-P.fieldBeneath) gc.setColor(frameColor[P.strength])gc.rectangle("line",-7,-7,314,614)--Draw boarder - + if modeEnv.royaleMode then + gc.setColor(1,1,1) + for i=1,P.strength do + gc.draw(badgeIcon,61*i-47,15,nil,3) + end + end if P.result then gc.setColor(1,1,1,min(P.counter,60)*.01) setFont(100) - mStr(P.result,150,250) + mStr(P.result,150,235) + if P.killMark then + gc.setLineWidth(20) + gc.setColor(1,0,0,min(P.counter,25)*.04) + gc.circle("line",150,300,420-10*min(P.counter,30)) + end end gc.pop() else @@ -363,16 +400,6 @@ function Pnt.play() gc.translate(0,-P.fieldBeneath) gc.setColor(1,1,1)gc.rectangle("line",-3,-13,306,616)--Draw boarder - if modeEnv.royale then - if P.atkMode then - gc.setColor(1,.8,0,P.swappingAtkMode*.02) - gc.rectangle("fill",RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4) - end - gc.setColor(1,1,1,P.swappingAtkMode*.025) - gc.draw(royaleCtrlPad) - --Draw selector - end - local h=0 for i=1,#P.atkBuffer do local a=P.atkBuffer[i] @@ -385,19 +412,19 @@ function Pnt.play() end if a.countdown>0 then gc.setColor(attackColor[a.lv][1]) - gc.rectangle("fill",308,600-h,8,-bar+5) + gc.rectangle("fill",308,600-h,10,-bar+5) gc.setColor(attackColor[a.lv][2]) - gc.rectangle("fill",308,600-h+(-bar+5),8,-(-bar+5)*(1-a.countdown/a.cd0)) + gc.rectangle("fill",308,600-h+(-bar+5),10,-(-bar+5)*(1-a.countdown/a.cd0)) --Timing else attackColor.animate[a.lv]((sin((Timer()-i)*20)+1)*.5) - gc.rectangle("fill",308,600-h,8,-bar+5) + gc.rectangle("fill",308,600-h,10,-bar+5) --Warning end else gc.setColor(attackColor[a.lv][1]) bar=bar*(20-a.time)*.05 - gc.rectangle("fill",308,600-h,8,-bar+3) + gc.rectangle("fill",308,600-h,10,-bar+3) --Disappear end h=h+bar @@ -415,7 +442,7 @@ function Pnt.play() setFont(40) gc.setColor(1,1,1) if P.gameEnv.hold then - gc.print("Hold",-113,0) + gc.print("Hold",-115,-10) for i=1,#P.hb do for j=1,#P.hb[1] do if P.hb[i][j]>0 then @@ -424,7 +451,7 @@ function Pnt.play() end end end--Hold - gc.print("Next",336,0) + gc.print("Next",336,-10) for N=1,P.gameEnv.next do local b=P.nb[N] for i=1,#b do @@ -446,22 +473,30 @@ function Pnt.play() gc.pop() end--Draw starting counter for i=1,#P.bonus do - P.bonus[i]:draw(min((30-abs(P.bonus[i].t-30))*.05,1)*(not P.bonus[i].solid and #P.field>(9-P.bonus[i].dy*.03333)and .7 or 1)) + P.bonus[i]:draw(min((30-abs(P.bonus[i].t-30))*.05,1)*(not P.bonus[i].inf and #P.field>(9-P.bonus[i].dy*.0333)and .7 or 1)) end--Effects gc.setColor(1,1,1) - setFont(40) - gc.print(format("%.2f",P.time),-130,530)--Draw time - if mesDisp[gamemode]then mesDisp[gamemode]()end--Draw other message + setFont(35) + mStr(format("%.2f",P.time),-75,520)--Draw time + if mesDisp[gameMode]then mesDisp[gameMode]()end--Draw other message - setFont(15) gc.setColor(1,1,1) - gc.print("BPM",380,490) - gc.print("KPM",335,580) + setFont(15) + gc.print("BPM",390,490) + gc.print("KPM",350,583) setFont(30) - drawDial(350,520,P.dropSpeed) - drawDial(400,570,P.keySpeed) + drawDial(360,520,P.dropSpeed) + drawDial(405,575,P.keySpeed) --Speed dials + if modeEnv.royaleMode then + if P.atkMode then + gc.setColor(1,.8,0,P.swappingAtkMode*.02) + gc.rectangle("fill",RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4) + end + gc.setColor(1,1,1,P.swappingAtkMode*.025) + gc.draw(royaleCtrlPad) + end gc.pop() end end--Draw players @@ -469,16 +504,16 @@ function Pnt.play() for i=1,3 do gc.draw(PTC.attack[i]) end - for i=1,#FX.badge do - local b=FX.badge[i] - local t=b.t<10 and 0 or b.t<50 and(sin(1.5*(b.t/20-1.5))+1)*.5 or 1 - gc.setColor(1,1,1,b.t<10 and b.t*.1 or b.t<50 and 1 or(60-b.t)*.1) - gc.draw(badgeIcon,b[1]+(b[3]-b[1])*t,b[2]+(b[4]-b[2])*t,nil,b.size,nil,14,14) - end if setting.virtualkeySwitch then drawVirtualkey() end if modeEnv.royaleMode then + for i=1,#FX.badge do + local b=FX.badge[i] + local t=b.t<10 and 0 or b.t<50 and(sin(1.5*(b.t/20-1.5))+1)*.5 or 1 + gc.setColor(1,1,1,b.t<10 and b.t*.1 or b.t<50 and 1 or(60-b.t)*.1) + gc.draw(badgeIcon,b[1]+(b[3]-b[1])*t,b[2]+(b[4]-b[2])*t,nil,b.size,nil,14,14) + end P=players[1] if P.atkMode~=4 then gc.setLineWidth(5) @@ -487,11 +522,9 @@ function Pnt.play() gc.setLineWidth(9) gc.setColor(1,.6,.2,.4) end - for i=1,#players.alive do - local p=players.alive[i] - if p.atking==players[1]then - gc.line(p.centerX,p.centerY,P.centerX,P.centerY) - end + for i=1,#players[1].atker do + local p=players[1].atker[i] + gc.line(p.centerX,p.centerY,P.centerX,P.centerY) end if P.atkMode~=4 then if P.atking then @@ -504,11 +537,11 @@ end function Pnt.setting() gc.setColor(1,1,1) setFont(35) - mStr("DAS:"..setting.das,328,163) - mStr("ARR:"..setting.arr,543,163) + mStr("DAS:"..setting.das,288,158) + mStr("ARR:"..setting.arr,503,158) setFont(18) - mStr("softdropDAS:"..setting.sddas,328,250) - mStr("softdropARR:"..setting.sdarr,543,250) + mStr("softdropDAS:"..setting.sddas,288,249) + mStr("softdropARR:"..setting.sdarr,503,249) end function Pnt.setting2() if keyboardSetting then @@ -529,7 +562,7 @@ function Pnt.setting2() for y=1,13 do mStr(actName_show[y],150,40*y) for x=1,2 do - mStr(setting.keyMap[curBoard+x*8-8][y],200*x+140,40*y) + mStr(setting.keyMap[curBoard+x*8-8][y],200*x+140,40*y-3) end gc.line(40,40*y-10,640,40*y-10) end @@ -537,13 +570,13 @@ function Pnt.setting2() gc.line(200*x-160,30,200*x-160,550) end gc.line(40,550,640,550) - gc.print("Keyboard | Joystick",330,3) + gc.print("Keyboard | Joystick",335,1) gc.print("Arrowkey to select/change slot,Enter to change,Esc back",50,620) setFont(40) gc.print("< P"..curBoard.."/P8 >",430,570) end function Pnt.setting3() - drawVirtualkey(sel) + VirtualkeyPreview() local d=snapLevelValue[snapLevel] if d>=10 then gc.setLineWidth(3) @@ -565,7 +598,7 @@ function Pnt.help() gc.draw(titleImage,180,600,.2,.7+.05*sin(Timer()*2),nil,140,100) end function Pnt.stat() - setFont(30) + setFont(35) gc.setColor(1,1,1) for i=1,10 do gc.print(Text.stat[i],350,20+40*i) diff --git a/scene.lua b/scene.lua index b0afcd42..df301d9d 100644 --- a/scene.lua +++ b/scene.lua @@ -23,6 +23,7 @@ end function game.mode() saveData() modeSel=modeSel or 1 + levelSel=levelSel or 3 scene="mode" curBG="none" keeprun=true @@ -64,8 +65,8 @@ function game.setting3() scene="setting3" curBG="game1" keeprun=true + defaultSel=1 sel=nil - keyssetting=nil snapLevel=1 BGM("blank") end--Touch setting diff --git a/siyuanhei.otf b/siyuanhei.otf deleted file mode 100644 index 53e03e03..00000000 Binary files a/siyuanhei.otf and /dev/null differ diff --git a/texture.lua b/texture.lua index 1962a8a3..cc98ed4f 100644 --- a/texture.lua +++ b/texture.lua @@ -28,7 +28,7 @@ do royaleCtrlPad=C(300,100) gc.setLineWidth(2) for i=1,4 do gc.rectangle("line",RCPB[2*i-1],RCPB[2*i],90,35,8,4) - mStr(atkModeName[i],RCPB[2*i-1]+45,RCPB[2*i]+6) + mStr(atkModeName[i],RCPB[2*i-1]+45,RCPB[2*i]+3) end end diff --git a/timer.lua b/timer.lua index 29ce2358..f7332a97 100644 --- a/timer.lua +++ b/timer.lua @@ -102,10 +102,10 @@ function Tmr.play(dt) pressKey(P.ai.controls[1],P) releaseKey(P.ai.controls[1],P) rem(P.ai.controls,1) - P.ai.controlDelay=P.ai.controlDelay0+2 + P.ai.controlDelay=P.ai.controlDelay0+1 else AI_getControls(P.ai.controls) - P.ai.controlDelay=rnd(3)*P.ai.controlDelay0 + P.ai.controlDelay=2*P.ai.controlDelay0 end end end @@ -159,11 +159,10 @@ function Tmr.play(dt) removeRow(P.field,P.clearing[i]) removeRow(P.visTime,P.clearing[i]) end - while #P.clearing>0 do + while P.clearing[1]do rem(P.clearing) end end - --Rows cleared drop elseif P.waiting>0 then P.waiting=P.waiting-1 if P.waiting<=0 then @@ -195,7 +194,10 @@ function Tmr.play(dt) if P.falling>0 then P.falling=P.falling-1 if P.falling<=0 then - if #P.field>P.clearing[1]then SFX("fall")end + if #P.field>P.clearing[1]then + SFX("fall") + VIB(1) + end for i=1,#P.clearing do removeRow(P.field,P.clearing[i]) removeRow(P.visTime,P.clearing[i]) @@ -215,11 +217,11 @@ function Tmr.play(dt) local b=P.bonus[i] if b.inf then if b.t<30 then - b.t=b.t+1 + b.t=b.t+.5 end else - b.t=b.t+1 - if b.t==60 then rem(P.bonus,i)end + b.t=b.t+b.speed + if b.t>=60 then rem(P.bonus,i)end end end for i=#P.task,1,-1 do @@ -230,7 +232,7 @@ function Tmr.play(dt) atk.time=atk.time+1 if not atk.sent then if atk.countdown>0 then - atk.countdown=atk.countdown-1 + atk.countdown=atk.countdown-garbageSpeed end else if atk.time>20 then @@ -238,12 +240,12 @@ function Tmr.play(dt) end end end - if P.fieldBeneath>0 then P.fieldBeneath=P.fieldBeneath-3 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.royale and frame%75==0 then + if modeEnv.royaleMode and frame%60==0 then freshRoyaleTarget() end setmetatable(_G,nil) diff --git a/toolfunc.lua b/toolfunc.lua index 89b7abb0..d4bfb4d7 100644 --- a/toolfunc.lua +++ b/toolfunc.lua @@ -70,6 +70,11 @@ function stencil_field_small() end --Single-usage funcs +function VIB(t) + if setting.vib>0 then + love.system.vibrate(setting.vib+t) + end +end function sysSFX(s,v) if setting.sfx then local n=1 @@ -117,11 +122,6 @@ function gotoScene(s,style) Buttons.sel=nil end end -function startGame(mode) - --rec="" - gamemode=mode - gotoScene("play") -end function back() local t=prevMenu[scene] if type(t)=="string"then @@ -175,13 +175,13 @@ function loadSetting() if find(i,"=")then local t=sub(i,1,find(i,"=")-1) local v=sub(i,find(i,"=")+1) - if t=="sfx"or t=="bgm"then + if t=="sfx"or t=="bgm"or t=="bgblock"then setting[t]=v=="true" + elseif t=="vib"then + setting.vib=toN(v:match("[0123]"))or 0 elseif t=="fullscreen"then setting.fullscreen=v=="true" love.window.setFullscreen(setting.fullscreen) - elseif t=="bgblock"then - setting.bgblock=v=="true" elseif t=="keymap"then v=string.splitS(v,"/") for i=1,16 do @@ -208,22 +208,19 @@ function loadSetting() elseif t=="virtualkey"then v=string.splitS(v,"/") for i=1,10 do - if not v[i]then goto continue end + if not v[i]then goto c end virtualkey[i]=string.splitS(v[i],",") for j=1,4 do virtualkey[i][j]=toN(virtualkey[i][j]) end - ::continue:: + ::c:: end elseif t=="virtualkeyAlpha"then setting.virtualkeyAlpha=int(abs(toN(v))) - elseif t=="virtualkeyIcon"then - setting.virtualkeyIcon=v=="true" - elseif t=="virtualkeySwitch"then - setting.virtualkeySwitch=v=="true" + elseif t=="virtualkeyIcon"or t=="virtualkeySwitch"then + setting[t]=v=="true" elseif t=="frameMul"then - v=min(max(toN(v)or 100,0),100) - setting.frameMul=v + setting.frameMul=min(max(toN(v)or 100,0),100) elseif t=="das"or t=="arr"or t=="sddas"or t=="sdarr"then v=toN(v)if not v or v<0 then v=0 end setting[t]=int(v) @@ -252,6 +249,7 @@ function saveSetting() local t=table.concat({ stringPack("sfx=",setting.sfx), stringPack("bgm=",setting.bgm), + stringPack("vib=",setting.vib), stringPack("fullscreen=",setting.fullscreen), stringPack("bgblock=",setting.bgblock), stringPack("das=",setting.das),