重新组织玩家各种生成特效的方法,使用的地方不传入各种参数更简洁易读
有特殊需要越过设置显示请使用几个_XXX方法(注释了Not used)
This commit is contained in:
@@ -16,117 +16,164 @@ local ply_draw=require"parts.player.draw"
|
|||||||
local ply_update=require"parts.player.update"
|
local ply_update=require"parts.player.update"
|
||||||
|
|
||||||
--------------------------<FX>--------------------------
|
--------------------------<FX>--------------------------
|
||||||
|
function Player:_showText(text,dx,dy,font,style,spd,stop)
|
||||||
|
ins(self.bonus,TEXT.getText(text,150+dx,300+dy,font,style,spd,stop))
|
||||||
|
end
|
||||||
|
function Player:_createLockFX(x,y,t)--Not used
|
||||||
|
ins(self.lockFX,{x,y,0,t})
|
||||||
|
end
|
||||||
|
function Player:_createDropFX(x,y,w,h)--Not used
|
||||||
|
ins(self.dropFX,{x,y,w,h})
|
||||||
|
end
|
||||||
|
function Player:_createMoveFX(color,x,y,spd)--Not used
|
||||||
|
ins(self.moveFX,{color,x,y,0,spd})
|
||||||
|
end
|
||||||
|
function Player:_createClearingFX(y,spd)--Not used
|
||||||
|
ins(self.clearFX,{y,0,spd})
|
||||||
|
end
|
||||||
function Player:showText(text,dx,dy,font,style,spd,stop)
|
function Player:showText(text,dx,dy,font,style,spd,stop)
|
||||||
if self.gameEnv.text then
|
if self.gameEnv.text then
|
||||||
ins(self.bonus,TEXT.getText(text,150+dx,300+dy,font,style,spd,stop))
|
ins(self.bonus,TEXT.getText(text,150+dx,300+dy,font,style,spd,stop))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player:showTextF(text,dx,dy,font,style,spd,stop)
|
function Player:popScore(score)
|
||||||
ins(self.bonus,TEXT.getText(text,150+dx,300+dy,font,style,spd,stop))
|
if self.gameEnv.score then
|
||||||
end
|
self:_showText(
|
||||||
function Player:popScore(score,x,y)
|
score,
|
||||||
self:showText(
|
self:getCenterX()*30,
|
||||||
score,x,y,
|
(10-self:getCenterY())*30+self.fieldBeneath+self.fieldUp,
|
||||||
40-600/(score+20),
|
40-600/(score+20),
|
||||||
'score',2
|
'score',2
|
||||||
)
|
)
|
||||||
end
|
|
||||||
function Player:createLockFX()
|
|
||||||
local CB=self.cur.bk
|
|
||||||
local t=12-self.gameEnv.lockFX*2
|
|
||||||
|
|
||||||
for i=1,#CB do
|
|
||||||
local y=self.curY+i-1
|
|
||||||
local L=self.clearedRow
|
|
||||||
for j=1,#L do
|
|
||||||
if L[j]==y then goto CONTINUE_skip end
|
|
||||||
end
|
|
||||||
y=-30*y
|
|
||||||
for j=1,#CB[1]do
|
|
||||||
if CB[i][j]then
|
|
||||||
ins(self.lockFX,{30*(self.curX+j-2),y,0,t})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
::CONTINUE_skip::
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player:createDropFX(x,y,w,h)
|
function Player:createLockFX()
|
||||||
ins(self.dropFX,{x,y,w,h,0,13-2*self.gameEnv.dropFX})
|
if self.gameEnv.lockFX then
|
||||||
|
local CB=self.cur.bk
|
||||||
|
local t=12-self.gameEnv.lockFX*2
|
||||||
|
|
||||||
|
for i=1,#CB do
|
||||||
|
local y=self.curY+i-1
|
||||||
|
local L=self.clearedRow
|
||||||
|
for j=1,#L do
|
||||||
|
if L[j]==y then goto CONTINUE_skip end
|
||||||
|
end
|
||||||
|
y=-30*y
|
||||||
|
for j=1,#CB[1]do
|
||||||
|
if CB[i][j]then
|
||||||
|
ins(self.lockFX,{30*(self.curX+j-2),y,0,t})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
::CONTINUE_skip::
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function Player:createMoveFX(dir)
|
function Player:clearLockFX()
|
||||||
local T=10-1.5*self.gameEnv.moveFX
|
for i=1,#self.lockFX do
|
||||||
local C=self.cur.color
|
self.lockFX[i]=nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function Player:createDropFX()
|
||||||
local CB=self.cur.bk
|
local CB=self.cur.bk
|
||||||
local x=self.curX-1
|
if self.gameEnv.dropFX and self.gameEnv.block and self.curY-self.ghoY-#CB>-1 then
|
||||||
local y=self.gameEnv.smooth and self.curY+self.dropDelay/self.gameEnv.drop-2 or self.curY-1
|
ins(self.dropFX,{self.curX,self.curY-1,#CB[1],self.curY-self.ghoY-#CB+1,0,13-2*self.gameEnv.dropFX})
|
||||||
if dir=='left'then
|
end
|
||||||
for i=1,#CB do for j=#CB[1],1,-1 do
|
end
|
||||||
if self.cur.bk[i][j]then
|
function Player:createMoveFX(moveDir)
|
||||||
ins(self.moveFX,{C,x+j,y+i,0,T})
|
local ENV=self.gameEnv
|
||||||
break
|
if not(ENV.moveFX and ENV.block)then
|
||||||
|
local spd=10-1.5*ENV.moveFX
|
||||||
|
local C=self.cur.color
|
||||||
|
local CB=self.cur.bk
|
||||||
|
local x=self.curX-1
|
||||||
|
local y=ENV.smooth and self.curY+self.dropDelay/ENV.drop-2 or self.curY-1
|
||||||
|
local L=self.moveFX
|
||||||
|
if moveDir=='left'then
|
||||||
|
for i=1,#CB do
|
||||||
|
for j=#CB[1],1,-1 do
|
||||||
|
if CB[i][j]then
|
||||||
|
ins(L,{C,x+j,y+i,0,spd})
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end end
|
elseif moveDir=='right'then
|
||||||
elseif dir=='right'then
|
for i=1,#CB do
|
||||||
for i=1,#CB do for j=1,#CB[1]do
|
for j=1,#CB[1]do
|
||||||
if self.cur.bk[i][j]then
|
if CB[i][j]then
|
||||||
ins(self.moveFX,{C,x+j,y+i,0,T})
|
ins(L,{C,x+j,y+i,0,spd})
|
||||||
break
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end end
|
elseif moveDir=='down'then
|
||||||
elseif dir=='down'then
|
for j=1,#CB[1]do
|
||||||
for j=1,#CB[1]do for i=#CB,1,-1 do
|
for i=#CB,1,-1 do
|
||||||
if self.cur.bk[i][j]then
|
if CB[i][j]then
|
||||||
ins(self.moveFX,{C,x+j,y+i,0,T})
|
ins(L,{C,x+j,y+i,0,spd})
|
||||||
break
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end end
|
else
|
||||||
else
|
for i=1,#CB do
|
||||||
for i=1,#CB do for j=1,#CB[1]do
|
for j=1,#CB[1]do
|
||||||
if self.cur.bk[i][j]then
|
if CB[i][j]then
|
||||||
ins(self.moveFX,{C,x+j,y+i,0,T})
|
ins(L,{C,x+j,y+i,0,spd})
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function Player:createClearingFX(y)
|
||||||
|
if self.gameEnv.clearFX then
|
||||||
|
ins(self.clearFX,{y,0,7-self.gameEnv.clearFX})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player:createSplashFX(h)
|
function Player:createSplashFX(h)
|
||||||
local L=self.field[h]
|
if self.gameEnv.splashFX then
|
||||||
local size=self.size
|
local L=self.field[h]
|
||||||
local y=self.fieldY+size*(self.fieldOff.y+self.fieldBeneath+self.fieldUp+615)
|
local size=self.size
|
||||||
for x=1,10 do
|
local y=self.fieldY+size*(self.fieldOff.y+self.fieldBeneath+self.fieldUp+615)-30*h*size
|
||||||
local c=L[x]
|
for x=1,10 do
|
||||||
if c>0 then
|
local c=L[x]
|
||||||
SYSFX.newCell(
|
if c>0 then
|
||||||
2.5-self.gameEnv.splashFX*.4,
|
SYSFX.newCell(
|
||||||
self.skinLib[c],
|
2.5-self.gameEnv.splashFX*.4,
|
||||||
size,
|
self.skinLib[c],
|
||||||
self.fieldX+(30*x-15)*size,y-30*h*size,
|
size,
|
||||||
rnd()*5-2.5,rnd()*-1,
|
self.fieldX+(30*x-15)*size,y,
|
||||||
0,.6
|
rnd()*5-2.5,rnd()*-1,
|
||||||
)
|
0,.6
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player:createClearingFX(y,spd)
|
function Player:createBeam(R,send)
|
||||||
ins(self.clearFX,{y,0,spd})
|
if self.gameEnv.atkFX then
|
||||||
end
|
local power=self.gameEnv.atkFX
|
||||||
function Player:createBeam(R,send,power,color)
|
local color=self.cur.color
|
||||||
local x1,y1,x2,y2
|
local x1,y1,x2,y2
|
||||||
if self.miniMode then
|
if self.miniMode then
|
||||||
x1,y1=self.centerX,self.centerY
|
x1,y1=self.centerX,self.centerY
|
||||||
else
|
else
|
||||||
local C=self.cur
|
local C=self.cur
|
||||||
local sc=C.rs.centerPos[C.id][C.dir]
|
local sc=C.rs.centerPos[C.id][C.dir]
|
||||||
x1,y1=self.x+(30*(self.curX+sc[2])-30+15+150)*self.size,self.y+(600-30*(self.curY+sc[1])+15)*self.size
|
x1=self.x+(30*(self.curX+sc[2])-30+15+150)*self.size
|
||||||
end
|
y1=self.y+(600-30*(self.curY+sc[1])+15+self.fieldUp+self.fieldBeneath)*self.size
|
||||||
if R.small then x2,y2=R.centerX,R.centerY
|
end
|
||||||
else x2,y2=R.x+308*R.size,R.y+450*R.size
|
if R.small then x2,y2=R.centerX,R.centerY
|
||||||
end
|
else x2,y2=R.x+308*R.size,R.y+450*R.size
|
||||||
|
end
|
||||||
|
|
||||||
local c=minoColor[color]
|
local c=minoColor[color]
|
||||||
local r,g,b=c[1]*2,c[2]*2,c[3]*2
|
local r,g,b=c[1]*2,c[2]*2,c[3]*2
|
||||||
|
|
||||||
local a=GAME.modeEnv.royaleMode and not(self.type=='human'or R.type=='human')and .2 or 1
|
local a=GAME.modeEnv.royaleMode and not(self.type=='human'or R.type=='human')and .2 or 1
|
||||||
SYSFX.newAttack(1-power*.1,x1,y1,x2,y2,int(send^.7*(4+power)),r,g,b,a*(power+2)*.0626)
|
SYSFX.newAttack(1-power*.1,x1,y1,x2,y2,int(send^.7*(4+power)),r,g,b,a*(power+2)*.0626)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
--------------------------</FX>--------------------------
|
--------------------------</FX>--------------------------
|
||||||
|
|
||||||
@@ -356,7 +403,6 @@ function Player:ifoverlap(bk,x,y)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player:attack(R,send,time,line,fromStream)
|
function Player:attack(R,send,time,line,fromStream)
|
||||||
local atkFX=self.gameEnv.atkFX
|
|
||||||
if GAME.net then
|
if GAME.net then
|
||||||
if self.type=='human'then--Local player attack others
|
if self.type=='human'then--Local player attack others
|
||||||
ins(GAME.rep,self.frameRun)
|
ins(GAME.rep,self.frameRun)
|
||||||
@@ -367,9 +413,7 @@ function Player:attack(R,send,time,line,fromStream)
|
|||||||
line*0x100000000+
|
line*0x100000000+
|
||||||
0x2000000000000
|
0x2000000000000
|
||||||
)
|
)
|
||||||
if atkFX then
|
self:createBeam(R,send)
|
||||||
self:createBeam(R,send,atkFX,self.cur.color)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if fromStream and R.type=='human'then--Local player receiving lines
|
if fromStream and R.type=='human'then--Local player receiving lines
|
||||||
ins(GAME.rep,R.frameRun)
|
ins(GAME.rep,R.frameRun)
|
||||||
@@ -384,9 +428,7 @@ function Player:attack(R,send,time,line,fromStream)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
R:receive(self,send,time,line)
|
R:receive(self,send,time,line)
|
||||||
if atkFX then
|
self:createBeam(R,send)
|
||||||
self:createBeam(R,send,atkFX,self.cur.color)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player:receive(A,send,time,line)
|
function Player:receive(A,send,time,line)
|
||||||
@@ -486,9 +528,7 @@ function Player:freshBlock(mode)--string mode: push/move/fresh/newBlock
|
|||||||
|
|
||||||
--Create FX if dropped
|
--Create FX if dropped
|
||||||
if self.curY>self.ghoY then
|
if self.curY>self.ghoY then
|
||||||
if ENV.dropFX and ENV.block and self.curY-self.ghoY-#CB>-1 then
|
self:createDropFX()
|
||||||
self:createDropFX(self.curX,self.curY-1,#CB[1],self.curY-self.ghoY-#CB+1)
|
|
||||||
end
|
|
||||||
if ENV.shakeFX then
|
if ENV.shakeFX then
|
||||||
self.fieldOff.vy=.5
|
self.fieldOff.vy=.5
|
||||||
end
|
end
|
||||||
@@ -699,7 +739,7 @@ function Player:spin(d,ifpre)
|
|||||||
local ix,iy=baseX+kickData[test][1],baseY+kickData[test][2]
|
local ix,iy=baseX+kickData[test][1],baseY+kickData[test][2]
|
||||||
if (self.freshTime>0 or kickData[test][2]<=0)and not self:ifoverlap(icb,ix,iy)then
|
if (self.freshTime>0 or kickData[test][2]<=0)and not self:ifoverlap(icb,ix,iy)then
|
||||||
--Create moveFX at the original position
|
--Create moveFX at the original position
|
||||||
if self.gameEnv.moveFX and self.gameEnv.block then self:createMoveFX()end
|
self:createMoveFX()
|
||||||
|
|
||||||
--Change block position
|
--Change block position
|
||||||
sc,C.bk,C.dir=isc,icb,idir
|
sc,C.bk,C.dir=isc,icb,idir
|
||||||
@@ -1098,22 +1138,15 @@ do--Player.drop(self)--Place piece
|
|||||||
--Create clearing FX
|
--Create clearing FX
|
||||||
for i=1,cc do
|
for i=1,cc do
|
||||||
local y=self.clearedRow[i]
|
local y=self.clearedRow[i]
|
||||||
if ENV.clearFX then self:createClearingFX(y,7-ENV.clearFX)end
|
self:createClearingFX(y)
|
||||||
if ENV.splashFX then self:createSplashFX(y)end
|
self:createSplashFX(y)
|
||||||
end
|
end
|
||||||
|
|
||||||
--Create locking FX
|
--Create locking FX
|
||||||
if ENV.lockFX then
|
if cc==0 then
|
||||||
if cc==0 then
|
self:createLockFX()
|
||||||
self:createLockFX()
|
else
|
||||||
else
|
self:clearLockFX()
|
||||||
_=#self.lockFX
|
|
||||||
if _>0 then
|
|
||||||
for _=1,_ do
|
|
||||||
rem(self.lockFX)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--Final spin check
|
--Final spin check
|
||||||
@@ -1434,13 +1467,7 @@ do--Player.drop(self)--Place piece
|
|||||||
if self.dropSpeed>60 then cscore=cscore*(.9+self.dropSpeed/600)end
|
if self.dropSpeed>60 then cscore=cscore*(.9+self.dropSpeed/600)end
|
||||||
|
|
||||||
cscore=int(cscore)
|
cscore=int(cscore)
|
||||||
if ENV.score then
|
self:popScore(cscore)
|
||||||
self:popScore(
|
|
||||||
cscore,
|
|
||||||
self:getCenterX()*30,
|
|
||||||
(10-self:getCenterY())*30+self.fieldBeneath+self.fieldUp
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
piece.row,piece.dig=cc,gbcc
|
piece.row,piece.dig=cc,gbcc
|
||||||
piece.score=cscore
|
piece.score=cscore
|
||||||
@@ -1457,7 +1484,7 @@ do--Player.drop(self)--Place piece
|
|||||||
if not finish then finish='finish'end
|
if not finish then finish='finish'end
|
||||||
end
|
end
|
||||||
elseif ENV.missionKill then
|
elseif ENV.missionKill then
|
||||||
self:showText(text.missionFailed,0,140,40,'flicker',.5)
|
self:_showText(text.missionFailed,0,140,40,'flicker',.5)
|
||||||
SFX.play('finesseError_long',.6)
|
SFX.play('finesseError_long',.6)
|
||||||
finish=true
|
finish=true
|
||||||
end
|
end
|
||||||
@@ -1672,9 +1699,9 @@ function Player:win(result)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if GAME.curMode.name=='custom_puzzle'then
|
if GAME.curMode.name=='custom_puzzle'then
|
||||||
self:showTextF(text.win,0,0,90,'beat',.4)
|
self:_showText(text.win,0,0,90,'beat',.4)
|
||||||
else
|
else
|
||||||
self:showTextF(text.win,0,0,90,'beat',.5,.2)
|
self:_showText(text.win,0,0,90,'beat',.5,.2)
|
||||||
end
|
end
|
||||||
if self.type=='human'then
|
if self.type=='human'then
|
||||||
gameOver()
|
gameOver()
|
||||||
@@ -1725,10 +1752,10 @@ function Player:lose(force)
|
|||||||
if #PLY_ALIVE==ROYALEDATA.stage[GAME.stage]then
|
if #PLY_ALIVE==ROYALEDATA.stage[GAME.stage]then
|
||||||
royaleLevelup()
|
royaleLevelup()
|
||||||
end
|
end
|
||||||
self:showTextF(self.modeData.place,0,120,60,'appear',.26,.9)
|
self:_showText(self.modeData.place,0,120,60,'appear',.26,.9)
|
||||||
end
|
end
|
||||||
self.gameEnv.keepVisible=self.gameEnv.visible~='show'
|
self.gameEnv.keepVisible=self.gameEnv.visible~='show'
|
||||||
self:showTextF(text.lose,0,0,90,'appear',.26,.9)
|
self:_showText(text.lose,0,0,90,'appear',.26,.9)
|
||||||
if self.type=='human'then
|
if self.type=='human'then
|
||||||
GAME.result='gameover'
|
GAME.result='gameover'
|
||||||
SFX.play('fail')
|
SFX.play('fail')
|
||||||
@@ -1765,9 +1792,7 @@ function Player:act_moveLeft(auto)
|
|||||||
end
|
end
|
||||||
elseif self.control and self.waiting==-1 then
|
elseif self.control and self.waiting==-1 then
|
||||||
if self.cur and not self:ifoverlap(self.cur.bk,self.curX-1,self.curY)then
|
if self.cur and not self:ifoverlap(self.cur.bk,self.curX-1,self.curY)then
|
||||||
if self.gameEnv.moveFX and self.gameEnv.block then
|
self:createMoveFX('left')
|
||||||
self:createMoveFX('left')
|
|
||||||
end
|
|
||||||
self.curX=self.curX-1
|
self.curX=self.curX-1
|
||||||
self:freshBlock('move')
|
self:freshBlock('move')
|
||||||
if self.sound and self.curY==self.ghoY then SFX.play('move')end
|
if self.sound and self.curY==self.ghoY then SFX.play('move')end
|
||||||
@@ -1792,9 +1817,7 @@ function Player:act_moveRight(auto)
|
|||||||
end
|
end
|
||||||
elseif self.control and self.waiting==-1 then
|
elseif self.control and self.waiting==-1 then
|
||||||
if self.cur and not self:ifoverlap(self.cur.bk,self.curX+1,self.curY)then
|
if self.cur and not self:ifoverlap(self.cur.bk,self.curX+1,self.curY)then
|
||||||
if self.gameEnv.moveFX and self.gameEnv.block then
|
self:createMoveFX('right')
|
||||||
self:createMoveFX('right')
|
|
||||||
end
|
|
||||||
self.curX=self.curX+1
|
self.curX=self.curX+1
|
||||||
self:freshBlock('move')
|
self:freshBlock('move')
|
||||||
if self.sound and self.curY==self.ghoY then SFX.play('move')end
|
if self.sound and self.curY==self.ghoY then SFX.play('move')end
|
||||||
@@ -1840,10 +1863,7 @@ function Player:act_hardDrop()
|
|||||||
SFX.play('drop_cancel',.3)
|
SFX.play('drop_cancel',.3)
|
||||||
else
|
else
|
||||||
if self.curY>self.ghoY then
|
if self.curY>self.ghoY then
|
||||||
local CB=self.cur.bk
|
self:createDropFX()
|
||||||
if ENV.dropFX and ENV.block and self.curY-self.ghoY-#CB>-1 then
|
|
||||||
self:createDropFX(self.curX,self.curY-1,#CB[1],self.curY-self.ghoY-#CB+1)
|
|
||||||
end
|
|
||||||
self.curY=self.ghoY
|
self.curY=self.ghoY
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
if self.sound then
|
if self.sound then
|
||||||
@@ -1881,9 +1901,8 @@ function Player:act_softDrop()
|
|||||||
y=y-1
|
y=y-1
|
||||||
end
|
end
|
||||||
if y>0 then
|
if y>0 then
|
||||||
if ENV.dropFX and ENV.block and self.curY-y-#CB>-1 then
|
self.ghoY=y
|
||||||
self:createDropFX(self.curX,self.curY-1,#CB[1],self.curY-y-#CB+1)
|
self:createDropFX()
|
||||||
end
|
|
||||||
self.curY=y
|
self.curY=y
|
||||||
self:freshBlock('move')
|
self:freshBlock('move')
|
||||||
SFX.play('swipe')
|
SFX.play('swipe')
|
||||||
@@ -1911,9 +1930,7 @@ function Player:act_insLeft(auto)
|
|||||||
if not self.cur then return end
|
if not self.cur then return end
|
||||||
local x0=self.curX
|
local x0=self.curX
|
||||||
while not self:ifoverlap(self.cur.bk,self.curX-1,self.curY)do
|
while not self:ifoverlap(self.cur.bk,self.curX-1,self.curY)do
|
||||||
if self.gameEnv.moveFX and self.gameEnv.block then
|
self:createMoveFX('left')
|
||||||
self:createMoveFX('left')
|
|
||||||
end
|
|
||||||
self.curX=self.curX-1
|
self.curX=self.curX-1
|
||||||
self:freshBlock('move')
|
self:freshBlock('move')
|
||||||
end
|
end
|
||||||
@@ -1933,9 +1950,7 @@ function Player:act_insRight(auto)
|
|||||||
if not self.cur then return end
|
if not self.cur then return end
|
||||||
local x0=self.curX
|
local x0=self.curX
|
||||||
while not self:ifoverlap(self.cur.bk,self.curX+1,self.curY)do
|
while not self:ifoverlap(self.cur.bk,self.curX+1,self.curY)do
|
||||||
if self.gameEnv.moveFX and self.gameEnv.block then
|
self:createMoveFX('right')
|
||||||
self:createMoveFX('right')
|
|
||||||
end
|
|
||||||
self.curX=self.curX+1
|
self.curX=self.curX+1
|
||||||
self:freshBlock('move')
|
self:freshBlock('move')
|
||||||
end
|
end
|
||||||
@@ -1954,10 +1969,7 @@ end
|
|||||||
function Player:act_insDown()
|
function Player:act_insDown()
|
||||||
if self.cur and self.curY>self.ghoY then
|
if self.cur and self.curY>self.ghoY then
|
||||||
local ENV=self.gameEnv
|
local ENV=self.gameEnv
|
||||||
local CB=self.cur.bk
|
self:createDropFX()
|
||||||
if ENV.dropFX and ENV.block and self.curY-self.ghoY-#CB>-1 then
|
|
||||||
self:createDropFX(self.curX,self.curY-1,#CB[1],self.curY-self.ghoY-#CB+1)
|
|
||||||
end
|
|
||||||
if ENV.shakeFX then
|
if ENV.shakeFX then
|
||||||
self.fieldOff.vy=.5
|
self.fieldOff.vy=.5
|
||||||
end
|
end
|
||||||
@@ -1969,9 +1981,7 @@ function Player:act_insDown()
|
|||||||
end
|
end
|
||||||
function Player:act_down1()
|
function Player:act_down1()
|
||||||
if self.cur and self.curY>self.ghoY then
|
if self.cur and self.curY>self.ghoY then
|
||||||
if self.gameEnv.moveFX and self.gameEnv.block then
|
self:createMoveFX('down')
|
||||||
self:createMoveFX('down')
|
|
||||||
end
|
|
||||||
self.curY=self.curY-1
|
self.curY=self.curY-1
|
||||||
self:freshBlock('fresh')
|
self:freshBlock('fresh')
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
@@ -1979,24 +1989,18 @@ function Player:act_down1()
|
|||||||
end
|
end
|
||||||
function Player:act_down4()
|
function Player:act_down4()
|
||||||
if self.cur and self.curY>self.ghoY then
|
if self.cur and self.curY>self.ghoY then
|
||||||
local y=max(self.curY-4,self.ghoY)
|
self.ghoY=max(self.curY-4,self.ghoY)
|
||||||
local CB=self.cur.bk
|
self:createDropFX()
|
||||||
if self.gameEnv.dropFX and self.gameEnv.block and self.curY-y-#CB>-1 then
|
self.curY=self.ghoY
|
||||||
self:createDropFX(self.curX,self.curY-1,#CB[1],self.curY-y-#CB+1)
|
|
||||||
end
|
|
||||||
self.curY=y
|
|
||||||
self:freshBlock('fresh')
|
self:freshBlock('fresh')
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player:act_down10()
|
function Player:act_down10()
|
||||||
if self.cur and self.curY>self.ghoY then
|
if self.cur and self.curY>self.ghoY then
|
||||||
local y=max(self.curY-10,self.ghoY)
|
self.ghoY=max(self.curY-10,self.ghoY)
|
||||||
local CB=self.cur.bk
|
self:createDropFX()
|
||||||
if self.gameEnv.dropFX and self.gameEnv.block and self.curY-y-#CB>-1 then
|
self.curY=self.ghoY
|
||||||
self:createDropFX(self.curX,self.curY-1,#CB[1],self.curY-y-#CB+1)
|
|
||||||
end
|
|
||||||
self.curY=y
|
|
||||||
self:freshBlock('fresh')
|
self:freshBlock('fresh')
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user