方块溅射特效机制升级,支持更高级的路径

This commit is contained in:
MrZ626
2020-11-25 15:53:11 +08:00
parent ac76984052
commit 6a2ac1e669
2 changed files with 27 additions and 11 deletions

View File

@@ -1,7 +1,6 @@
local gc=love.graphics local gc=love.graphics
local setColor,setWidth=gc.setColor,gc.setLineWidth local setColor,setWidth=gc.setColor,gc.setLineWidth
local max,min=math.max,math.min local max,min=math.max,math.min
local sin,cos=math.sin,math.cos
local rnd=math.random local rnd=math.random
local rem=table.remove local rem=table.remove
@@ -31,8 +30,14 @@ FXupdate.ripple=normUpdate
FXupdate.rectRipple=normUpdate FXupdate.rectRipple=normUpdate
FXupdate.shade=normUpdate FXupdate.shade=normUpdate
function FXupdate.cell(S,dt) function FXupdate.cell(S,dt)
if S.vx then
S.x=S.x+S.vx S.x=S.x+S.vx
S.y=S.y+S.vy S.y=S.y+S.vy
if S.ax then
S.vx=S.vx+S.ax
S.vy=S.vy+S.ay
end
end
S.t=S.t+dt*S.rate S.t=S.t+dt*S.rate
return S.t>1 return S.t>1
end end
@@ -148,15 +153,17 @@ function SYSFX.newShade(rate,r,g,b,x,y,w,h)
x=x,y=y,w=w,h=h, x=x,y=y,w=w,h=h,
} }
end end
function SYSFX.newCell(rate,image,x,y,size) function SYSFX.newCell(rate,image,size,x,y,vx,vy,ax,ay)
local v,a=1+rnd(),rnd()*6.28
fx[#fx+1]={ fx[#fx+1]={
update=FXupdate.cell, update=FXupdate.cell,
draw=FXdraw.cell, draw=FXdraw.cell,
t=0, t=0,
rate=rate,image=image, rate=rate*(.9+rnd()*.2),
x=x,y=y,size=size, image=image,
vx=v*cos(a),vy=v*sin(a), size=size,
x=x,y=y,
vx=vx,vy=vy,
ax=ax,ay=ay,
} }
end end
return SYSFX return SYSFX

View File

@@ -6,6 +6,7 @@ local Player={}--Player class
local int,ceil,rnd=math.floor,math.ceil,math.random local int,ceil,rnd=math.floor,math.ceil,math.random
local max,min=math.max,math.min local max,min=math.max,math.min
local sin,cos=math.sin,math.cos
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local kickList=require"parts/kickList" local kickList=require"parts/kickList"
@@ -80,12 +81,20 @@ function Player.createMoveFX(P,dir)
end end end end
end end
end end
function Player.createSplashFX(P,y) function Player.createSplashFX(P,h)
local L=P.field[y] local L=P.field[h]
local y=P.fieldY+P.size*(P.fieldOff.y+P.fieldBeneath+P.fieldUp+585)
for x=1,10 do for x=1,10 do
local c=L[x] local c=L[x]
if c>0 then if c>0 then
SYSFX.newCell(6-P.gameEnv.splashFX,SKIN.curText[c],P.fieldX+30*x-30,P.fieldY+600-30*y,1) local v,a=1+rnd(),rnd()*6.28
SYSFX.newCell(
6-P.gameEnv.splashFX,
SKIN.curText[c],
1,
P.fieldX+30*x-15,y-30*h,
v*cos(a),v*sin(a)
)
end end
end end
end end