diff --git a/Zframework/sysFX.lua b/Zframework/sysFX.lua index 96ff7f4b..806ae6d3 100644 --- a/Zframework/sysFX.lua +++ b/Zframework/sysFX.lua @@ -1,7 +1,8 @@ local gc=love.graphics local setColor=gc.setColor local setWidth=gc.setLineWidth -local ins,rem=table.insert,table.remove +local rem=table.remove +local max,min=math.max,math.min local fx={} @@ -20,22 +21,8 @@ function FXupdate.badge(S,dt) return S.t>=1 end function FXupdate.attack(S,dt) - S.t=S.t+dt - local L=S.drag - if S.t>.8 then - S.rad=S.rad*1.05+.1 - S.x,S.y=S.x2,S.y2 - elseif S.t>.2 then - local t=(S.t-.2)*1.6667 - t=(3-2*t)*t*t - S.x,S.y=S.x1*(1-t)+S.x2*t,S.y1*(1-t)+S.y2*t - - ins(L,S.x)ins(L,S.y) - end - if #L==4+4*SETTING.atkFX then - rem(L,1)rem(L,1) - end -return S.t>1 + S.t=S.t+dt*S.rate + return S.t>1 end function FXupdate.ripple(S,dt) S.t=S.t+dt*S.rate @@ -52,31 +39,29 @@ end local FXdraw={} function FXdraw.badge(S) - gc.setColor(1,1,1,S.t<.2 and S.t*.6 or S.t<.8 and 1 or(1-S.t)*.6) + setColor(1,1,1,S.t<.2 and S.t*.6 or S.t<.8 and 1 or(1-S.t)*.6) gc.draw(IMG.badgeIcon,S.x,S.y) end function FXdraw.attack(S) - gc.setLineWidth(5) - gc.push("transform") - local t=S.t - local a=(t<.2 and t*5 or t<.8 and 1 or 5-t*5)*S.a - local L=S.drag - local len=#L - local r,g,b=S.r,S.g,S.b - local rad,crn=S.rad,S.corner - for i=1,len,2 do - gc.setColor(r,g,b,.4*a*i/len) - gc.translate(L[i],L[i+1]) - gc.rotate(t*.1) - gc.circle("fill",0,0,rad,crn) - gc.rotate(-t*.1) - gc.translate(-L[i],-L[i+1]) - end - gc.translate(S.x,S.y) - gc.rotate(t*6) - gc.setColor(r,g,b,a*.5)gc.circle("line",0,0,rad,crn) - gc.setColor(r,g,b,a)gc.circle("fill",0,0,rad,crn) - gc.pop() + setColor(S.r*2,S.g*2,S.b*2,S.a*min(4-S.t*4,1)) + + setWidth(S.wid) + local t1,t2=max(5*S.t-4,0),min(S.t*4,1) + gc.line( + S.x1*(1-t1)+S.x2*t1, + S.y1*(1-t1)+S.y2*t1, + S.x1*(1-t2)+S.x2*t2, + S.y1*(1-t2)+S.y2*t2 + ) + + setWidth(S.wid*.6) + t1,t2=max(4*S.t-3,0),min(S.t*5,1) + gc.line( + S.x1*(1-t1)+S.x2*t1, + S.y1*(1-t1)+S.y2*t1, + S.x1*(1-t2)+S.x2*t2, + S.y1*(1-t2)+S.y2*t2 + ) end function FXdraw.ripple(S) local t=S.t @@ -119,19 +104,16 @@ function sysFX.newBadge(x1,y1,x2,y2) x2=x2,y2=y2, } end -function sysFX.newAttack(x1,y1,x2,y2,rad,corner,type,r,g,b,a) +function sysFX.newAttack(rate,x1,y1,x2,y2,wid,r,g,b,a) fx[#fx+1]={ update=FXupdate.attack, draw=FXdraw.attack, t=0, - x=x1,y=y1, + rate=rate, x1=x1,y1=y1,--Start pos x2=x2,y2=y2,--End pos - rad=rad, - corner=corner, - type=type, + wid=wid,--Line width r=r,g=g,b=b,a=a, - drag={},--Afterimage coordinate list } end function sysFX.newRipple(duration,x,y,r) diff --git a/parts/player.lua b/parts/player.lua index ad08ff31..523b543f 100644 --- a/parts/player.lua +++ b/parts/player.lua @@ -336,7 +336,6 @@ local function Pupdate_alive(P,dt) else P.curY=P.curY-D end - -- assert(P.curY==int(P.curY),"y:"..P.curY.." fall:"..D.." D_env:"..P.gameEnv.drop) end P:freshBlock(true,true) P.spinLast=false @@ -1481,7 +1480,7 @@ end function player.createClearingFX(P,y,spd) ins(P.clearFX,{y,0,spd}) end -function player.createBeam(P,R,send,time,target,color,clear,combo) +function player.createBeam(P,R,send,color) local x1,y1,x2,y2 if P.small then x1,y1=P.centerX,P.centerY else x1,y1=P.x+(30*(P.curX+P.sc[2])-30+15+150)*P.size,P.y+(600-30*(P.curY+P.sc[1])+15+70)*P.size @@ -1490,49 +1489,12 @@ function player.createBeam(P,R,send,time,target,color,clear,combo) else x2,y2=R.x+308*R.size,R.y+450*R.size end - local radius,corner - local a,r,g,b=1,unpack(SKIN.libColor[color]) - if clear.special then - radius=10+3*send+100/(target+4) - local t=clear.row - if t==1 then - corner=3 - r=.3+r*.4 - g=.3+g*.4 - b=.3+b*.4 - elseif t==2 then - corner=5 - r=.5+r*.5 - g=.5+g*.5 - b=.5+b*.5 - elseif t<6 then - corner=6 - r=.6+r*.4 - g=.6+g*.4 - b=.6+b*.4 - else - corner=20 - r=.8+r*.2 - g=.8+g*.2 - b=.8+b*.2 - end - else - if combo>3 then - radius=min(15+combo,30)+time*.1 - corner=3 - else - radius=30 - corner=4 - end - r=1-r*.3 - g=1-g*.3 - b=1-b*.3 - end - if modeEnv.royaleMode and not P.human and not R.human then - radius=radius*.4 - a=.35 - end - sysFX.newAttack(x1,y1,x2,y2,radius*(SETTING.atkFX+3)*.12,corner,type==1 and"fill"or"line",r,g,b,a*(SETTING.atkFX+5)*.1) + wid=int(send^.7*(4+SETTING.atkFX)) + local r,g,b=unpack(SKIN.libColor[color]) + r,g,b=r*2,g*2,b*2 + + local a=modeEnv.royaleMode and not(P.human or R.human)and .2 or 1 + sysFX.newAttack(1-SETTING.atkFX*.1,x1,y1,x2,y2,wid,r,g,b,a*(SETTING.atkFX+2)*.0626) end function player.newTask(P,code,data) local L=P.tasks @@ -1596,7 +1558,7 @@ function player.attack(P,R,send,time,...) B.sum=B.sum+send R.stat.recv=R.stat.recv+send if R.sound then - SFX.play(send<4 and "blip_1"or"blip_2",min(send+1,5)*.1) + SFX.play(send<4 and"blip_1"or"blip_2",min(send+1,5)*.1) end end end @@ -1884,7 +1846,7 @@ function player.spin(P,d,ifpre) if P.gameEnv.easyFresh then P:freshBlock(false,true) end - SFX.fieldPlay(ifpre and"prerotate"or "rotate",nil,P) + SFX.fieldPlay(ifpre and"prerotate"or"rotate",nil,P) return end for test=1,#iki do @@ -2446,7 +2408,7 @@ do--player.drop(P)--Place piece local M=#P.atker if M>0 then for i=1,M do - P:attack(P.atker[i],send,sendTime,M,CB.color,C,cmb) + P:attack(P.atker[i],send,CB.color) end else T=randomTarget(P) @@ -2459,7 +2421,7 @@ do--player.drop(P)--Place piece T=randomTarget(P) end if T then - P:attack(T,send,sendTime,1,CB.color,C,cmb) + P:attack(T,send,CB.color) end end if P.sound and send>3 then SFX.play("emit",min(send,7)*.1)end