新攻击特效(初版)
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
local gc=love.graphics
|
local gc=love.graphics
|
||||||
local setColor=gc.setColor
|
local setColor=gc.setColor
|
||||||
local setWidth=gc.setLineWidth
|
local setWidth=gc.setLineWidth
|
||||||
local ins,rem=table.insert,table.remove
|
local rem=table.remove
|
||||||
|
local max,min=math.max,math.min
|
||||||
|
|
||||||
local fx={}
|
local fx={}
|
||||||
|
|
||||||
@@ -20,22 +21,8 @@ function FXupdate.badge(S,dt)
|
|||||||
return S.t>=1
|
return S.t>=1
|
||||||
end
|
end
|
||||||
function FXupdate.attack(S,dt)
|
function FXupdate.attack(S,dt)
|
||||||
S.t=S.t+dt
|
S.t=S.t+dt*S.rate
|
||||||
local L=S.drag
|
return S.t>1
|
||||||
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
|
|
||||||
end
|
end
|
||||||
function FXupdate.ripple(S,dt)
|
function FXupdate.ripple(S,dt)
|
||||||
S.t=S.t+dt*S.rate
|
S.t=S.t+dt*S.rate
|
||||||
@@ -52,31 +39,29 @@ end
|
|||||||
|
|
||||||
local FXdraw={}
|
local FXdraw={}
|
||||||
function FXdraw.badge(S)
|
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)
|
gc.draw(IMG.badgeIcon,S.x,S.y)
|
||||||
end
|
end
|
||||||
function FXdraw.attack(S)
|
function FXdraw.attack(S)
|
||||||
gc.setLineWidth(5)
|
setColor(S.r*2,S.g*2,S.b*2,S.a*min(4-S.t*4,1))
|
||||||
gc.push("transform")
|
|
||||||
local t=S.t
|
setWidth(S.wid)
|
||||||
local a=(t<.2 and t*5 or t<.8 and 1 or 5-t*5)*S.a
|
local t1,t2=max(5*S.t-4,0),min(S.t*4,1)
|
||||||
local L=S.drag
|
gc.line(
|
||||||
local len=#L
|
S.x1*(1-t1)+S.x2*t1,
|
||||||
local r,g,b=S.r,S.g,S.b
|
S.y1*(1-t1)+S.y2*t1,
|
||||||
local rad,crn=S.rad,S.corner
|
S.x1*(1-t2)+S.x2*t2,
|
||||||
for i=1,len,2 do
|
S.y1*(1-t2)+S.y2*t2
|
||||||
gc.setColor(r,g,b,.4*a*i/len)
|
)
|
||||||
gc.translate(L[i],L[i+1])
|
|
||||||
gc.rotate(t*.1)
|
setWidth(S.wid*.6)
|
||||||
gc.circle("fill",0,0,rad,crn)
|
t1,t2=max(4*S.t-3,0),min(S.t*5,1)
|
||||||
gc.rotate(-t*.1)
|
gc.line(
|
||||||
gc.translate(-L[i],-L[i+1])
|
S.x1*(1-t1)+S.x2*t1,
|
||||||
end
|
S.y1*(1-t1)+S.y2*t1,
|
||||||
gc.translate(S.x,S.y)
|
S.x1*(1-t2)+S.x2*t2,
|
||||||
gc.rotate(t*6)
|
S.y1*(1-t2)+S.y2*t2
|
||||||
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()
|
|
||||||
end
|
end
|
||||||
function FXdraw.ripple(S)
|
function FXdraw.ripple(S)
|
||||||
local t=S.t
|
local t=S.t
|
||||||
@@ -119,19 +104,16 @@ function sysFX.newBadge(x1,y1,x2,y2)
|
|||||||
x2=x2,y2=y2,
|
x2=x2,y2=y2,
|
||||||
}
|
}
|
||||||
end
|
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]={
|
fx[#fx+1]={
|
||||||
update=FXupdate.attack,
|
update=FXupdate.attack,
|
||||||
draw=FXdraw.attack,
|
draw=FXdraw.attack,
|
||||||
t=0,
|
t=0,
|
||||||
x=x1,y=y1,
|
rate=rate,
|
||||||
x1=x1,y1=y1,--Start pos
|
x1=x1,y1=y1,--Start pos
|
||||||
x2=x2,y2=y2,--End pos
|
x2=x2,y2=y2,--End pos
|
||||||
rad=rad,
|
wid=wid,--Line width
|
||||||
corner=corner,
|
|
||||||
type=type,
|
|
||||||
r=r,g=g,b=b,a=a,
|
r=r,g=g,b=b,a=a,
|
||||||
drag={},--Afterimage coordinate list
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
function sysFX.newRipple(duration,x,y,r)
|
function sysFX.newRipple(duration,x,y,r)
|
||||||
|
|||||||
@@ -336,7 +336,6 @@ local function Pupdate_alive(P,dt)
|
|||||||
else
|
else
|
||||||
P.curY=P.curY-D
|
P.curY=P.curY-D
|
||||||
end
|
end
|
||||||
-- assert(P.curY==int(P.curY),"y:"..P.curY.." fall:"..D.." D_env:"..P.gameEnv.drop)
|
|
||||||
end
|
end
|
||||||
P:freshBlock(true,true)
|
P:freshBlock(true,true)
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
@@ -1481,7 +1480,7 @@ end
|
|||||||
function player.createClearingFX(P,y,spd)
|
function player.createClearingFX(P,y,spd)
|
||||||
ins(P.clearFX,{y,0,spd})
|
ins(P.clearFX,{y,0,spd})
|
||||||
end
|
end
|
||||||
function player.createBeam(P,R,send,time,target,color,clear,combo)
|
function player.createBeam(P,R,send,color)
|
||||||
local x1,y1,x2,y2
|
local x1,y1,x2,y2
|
||||||
if P.small then x1,y1=P.centerX,P.centerY
|
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
|
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
|
else x2,y2=R.x+308*R.size,R.y+450*R.size
|
||||||
end
|
end
|
||||||
|
|
||||||
local radius,corner
|
wid=int(send^.7*(4+SETTING.atkFX))
|
||||||
local a,r,g,b=1,unpack(SKIN.libColor[color])
|
local r,g,b=unpack(SKIN.libColor[color])
|
||||||
if clear.special then
|
r,g,b=r*2,g*2,b*2
|
||||||
radius=10+3*send+100/(target+4)
|
|
||||||
local t=clear.row
|
local a=modeEnv.royaleMode and not(P.human or R.human)and .2 or 1
|
||||||
if t==1 then
|
sysFX.newAttack(1-SETTING.atkFX*.1,x1,y1,x2,y2,wid,r,g,b,a*(SETTING.atkFX+2)*.0626)
|
||||||
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)
|
|
||||||
end
|
end
|
||||||
function player.newTask(P,code,data)
|
function player.newTask(P,code,data)
|
||||||
local L=P.tasks
|
local L=P.tasks
|
||||||
@@ -1596,7 +1558,7 @@ function player.attack(P,R,send,time,...)
|
|||||||
B.sum=B.sum+send
|
B.sum=B.sum+send
|
||||||
R.stat.recv=R.stat.recv+send
|
R.stat.recv=R.stat.recv+send
|
||||||
if R.sound then
|
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
|
end
|
||||||
end
|
end
|
||||||
@@ -1884,7 +1846,7 @@ function player.spin(P,d,ifpre)
|
|||||||
if P.gameEnv.easyFresh then
|
if P.gameEnv.easyFresh then
|
||||||
P:freshBlock(false,true)
|
P:freshBlock(false,true)
|
||||||
end
|
end
|
||||||
SFX.fieldPlay(ifpre and"prerotate"or "rotate",nil,P)
|
SFX.fieldPlay(ifpre and"prerotate"or"rotate",nil,P)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for test=1,#iki do
|
for test=1,#iki do
|
||||||
@@ -2446,7 +2408,7 @@ do--player.drop(P)--Place piece
|
|||||||
local M=#P.atker
|
local M=#P.atker
|
||||||
if M>0 then
|
if M>0 then
|
||||||
for i=1,M do
|
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
|
end
|
||||||
else
|
else
|
||||||
T=randomTarget(P)
|
T=randomTarget(P)
|
||||||
@@ -2459,7 +2421,7 @@ do--player.drop(P)--Place piece
|
|||||||
T=randomTarget(P)
|
T=randomTarget(P)
|
||||||
end
|
end
|
||||||
if T then
|
if T then
|
||||||
P:attack(T,send,sendTime,1,CB.color,C,cmb)
|
P:attack(T,send,CB.color)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if P.sound and send>3 then SFX.play("emit",min(send,7)*.1)end
|
if P.sound and send>3 then SFX.play("emit",min(send,7)*.1)end
|
||||||
|
|||||||
Reference in New Issue
Block a user