攻击特效和徽章特效并入sysFX
This commit is contained in:
@@ -6,6 +6,37 @@ local ins,rem=table.insert,table.remove
|
|||||||
local fx={}
|
local fx={}
|
||||||
|
|
||||||
local FXupdate={}
|
local FXupdate={}
|
||||||
|
function FXupdate.badge(S,dt)
|
||||||
|
S.t=S.t+dt
|
||||||
|
if S.t<.2 then
|
||||||
|
S.x,S.y=S.x1-14,S.y1-14
|
||||||
|
elseif S.t<.8 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-14,S.y1*(1-t)+S.y2*t-14
|
||||||
|
else
|
||||||
|
S.x,S.y=S.x2-14,S.y2-14
|
||||||
|
end
|
||||||
|
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
|
||||||
|
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
|
||||||
return S.t>=1
|
return S.t>=1
|
||||||
@@ -20,9 +51,36 @@ function FXupdate.shade(S,dt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local FXdraw={}
|
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)
|
||||||
|
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()
|
||||||
|
end
|
||||||
function FXdraw.ripple(S)
|
function FXdraw.ripple(S)
|
||||||
setWidth(2)
|
|
||||||
local t=S.t
|
local t=S.t
|
||||||
|
setWidth(2)
|
||||||
setColor(1,1,1,1-t)
|
setColor(1,1,1,1-t)
|
||||||
gc.circle("line",S.x,S.y,t*(2-t)*S.r)
|
gc.circle("line",S.x,S.y,t*(2-t)*S.r)
|
||||||
end
|
end
|
||||||
@@ -51,6 +109,31 @@ function sysFX.draw()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function sysFX.newBadge(x1,y1,x2,y2)
|
||||||
|
fx[#fx+1]={
|
||||||
|
update=FXupdate.badge,
|
||||||
|
draw=FXdraw.badge,
|
||||||
|
t=0,
|
||||||
|
x=x1,y=y1,
|
||||||
|
x1=x1,y1=y1,
|
||||||
|
x2=x2,y2=y2,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
function sysFX.newAttack(x1,y1,x2,y2,rad,corner,type,r,g,b,a)
|
||||||
|
fx[#fx+1]={
|
||||||
|
update=FXupdate.attack,
|
||||||
|
draw=FXdraw.attack,
|
||||||
|
t=0,
|
||||||
|
x=x1,y=y1,
|
||||||
|
x1=x1,y1=y1,--Start pos
|
||||||
|
x2=x2,y2=y2,--End pos
|
||||||
|
rad=rad,
|
||||||
|
corner=corner,
|
||||||
|
type=type,
|
||||||
|
r=r,g=g,b=b,a=a,
|
||||||
|
drag={},--Afterimage coordinate list
|
||||||
|
}
|
||||||
|
end
|
||||||
function sysFX.newRipple(duration,x,y,r)
|
function sysFX.newRipple(duration,x,y,r)
|
||||||
fx[#fx+1]={
|
fx[#fx+1]={
|
||||||
update=FXupdate.ripple,
|
update=FXupdate.ripple,
|
||||||
|
|||||||
@@ -321,8 +321,6 @@ function resetGameData()
|
|||||||
BGM.play(modeEnv.bgm)
|
BGM.play(modeEnv.bgm)
|
||||||
|
|
||||||
TEXT.clear()
|
TEXT.clear()
|
||||||
FX_badge={}
|
|
||||||
FX_attack={}
|
|
||||||
if modeEnv.royaleMode then
|
if modeEnv.royaleMode then
|
||||||
for i=1,#players do
|
for i=1,#players do
|
||||||
players[i]:changeAtk(randomTarget(players[i]))
|
players[i]:changeAtk(randomTarget(players[i]))
|
||||||
|
|||||||
@@ -1130,17 +1130,7 @@ function player.createBeam(P,R,send,time,target,color,clear,spin,combo)
|
|||||||
radius=radius*.4
|
radius=radius*.4
|
||||||
a=.35
|
a=.35
|
||||||
end
|
end
|
||||||
ins(FX_attack,{
|
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)
|
||||||
x=x1,y=y1,--Current pos
|
|
||||||
x1=x1,y1=y1,--Start pos
|
|
||||||
x2=x2,y2=y2,--End pos
|
|
||||||
rad=radius*(setting.atkFX+3)*.12,
|
|
||||||
corner=corner,
|
|
||||||
type=type==1 and"fill"or"line",
|
|
||||||
r=r,g=g,b=b,a=a*(setting.atkFX+5)*.1,
|
|
||||||
t=0,
|
|
||||||
drag={},--Afterimage coordinate list
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
function player.newTask(P,code,data)
|
function player.newTask(P,code,data)
|
||||||
local L=P.tasks
|
local L=P.tasks
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function Tick.throwBadge(data)--{ifAI,Sender,timer}
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Generate badge object
|
--Generate badge object
|
||||||
FX_badge[#FX_badge+1]={x1,y1,x2,y2,t=0}
|
sysFX.newBadge(x1,y1,x2,y2)
|
||||||
|
|
||||||
if not data[1]and data[3]%8==0 then
|
if not data[1]and data[3]%8==0 then
|
||||||
SFX.play("collect")
|
SFX.play("collect")
|
||||||
|
|||||||
Reference in New Issue
Block a user