整理代码
移除旧的切换攻击模式代码 旋转导致场地倾斜封装成玩家方法 调整瞬移到左右的场地晃动程度 调整场地平移晃动的恢复速度 软降触地时也会播放触地音效
This commit is contained in:
@@ -686,13 +686,7 @@ do
|
|||||||
sfx='prerotate'
|
sfx='prerotate'
|
||||||
elseif P:ifoverlap(icb,x,y+1)and P:ifoverlap(icb,x-1,y)and P:ifoverlap(icb,x+1,y)then
|
elseif P:ifoverlap(icb,x,y+1)and P:ifoverlap(icb,x-1,y)and P:ifoverlap(icb,x+1,y)then
|
||||||
sfx='rotatekick'
|
sfx='rotatekick'
|
||||||
if P.gameEnv.shakeFX then
|
P:_rotateField(d)
|
||||||
if d==1 or d==3 then
|
|
||||||
P.fieldOff.va=P.fieldOff.va+(2-d)*6e-3
|
|
||||||
else
|
|
||||||
P.fieldOff.va=P.fieldOff.va+P:getCenterX()*3e-3
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
sfx='rotate'
|
sfx='rotate'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -30,6 +30,20 @@ end
|
|||||||
function Player:_createClearingFX(y,spd)--Not used
|
function Player:_createClearingFX(y,spd)--Not used
|
||||||
ins(self.clearFX,{y,0,spd})
|
ins(self.clearFX,{y,0,spd})
|
||||||
end
|
end
|
||||||
|
function Player:_rotateField(dir)
|
||||||
|
if self.gameEnv.shakeFX then
|
||||||
|
if dir==1 or dir==3 then
|
||||||
|
self.fieldOff.va=self.fieldOff.va+(2-dir)*6e-3
|
||||||
|
else
|
||||||
|
self.fieldOff.va=self.fieldOff.va+self:getCenterX()*3e-3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function Player:checkTouchSound()
|
||||||
|
if self.sound and self.curY==self.ghoY then
|
||||||
|
SFX.play('touch')
|
||||||
|
end
|
||||||
|
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))
|
||||||
@@ -605,10 +619,9 @@ function Player:freshBlock(mode)--string mode: push/move/fresh/newBlock
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Play sound if touch ground
|
--Play sound if touch ground
|
||||||
if mode=='move'and self.sound and self.curY==self.ghoY then
|
if mode=='move'then
|
||||||
SFX.play('touch')
|
self:checkTouchSound()
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
function Player:lock()
|
function Player:lock()
|
||||||
local CB=self.cur.bk
|
local CB=self.cur.bk
|
||||||
@@ -803,13 +816,7 @@ function Player:spin(d,ifpre)
|
|||||||
sfx='prerotate'
|
sfx='prerotate'
|
||||||
elseif self:ifoverlap(icb,ix,iy+1)and self:ifoverlap(icb,ix-1,iy)and self:ifoverlap(icb,ix+1,iy)then
|
elseif self:ifoverlap(icb,ix,iy+1)and self:ifoverlap(icb,ix-1,iy)and self:ifoverlap(icb,ix+1,iy)then
|
||||||
sfx='rotatekick'
|
sfx='rotatekick'
|
||||||
if self.gameEnv.shakeFX then
|
self:_rotateField(d)
|
||||||
if d==1 or d==3 then
|
|
||||||
self.fieldOff.va=self.fieldOff.va+(2-d)*6e-3
|
|
||||||
else
|
|
||||||
self.fieldOff.va=self.fieldOff.va+self:getCenterX()*3e-3
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
sfx='rotate'
|
sfx='rotate'
|
||||||
end
|
end
|
||||||
@@ -1849,7 +1856,7 @@ local function _updateMisc(P)
|
|||||||
--Field shaking
|
--Field shaking
|
||||||
if P.gameEnv.shakeFX then
|
if P.gameEnv.shakeFX then
|
||||||
local O=P.fieldOff
|
local O=P.fieldOff
|
||||||
O.vx=O.vx*.7-abs(O.x)^1.3*(O.x>0 and .1 or -.1)
|
O.vx=O.vx*.6-abs(O.x)^1.3*(O.x>0 and .1 or -.1)
|
||||||
O.x=O.x+O.vx
|
O.x=O.x+O.vx
|
||||||
|
|
||||||
O.vy=O.vy*.7-abs(O.y)^1.2*(O.y>0 and .1 or -.1)
|
O.vy=O.vy*.7-abs(O.y)^1.2*(O.y>0 and .1 or -.1)
|
||||||
@@ -1950,13 +1957,9 @@ local function update_alive(P)
|
|||||||
|
|
||||||
if GAME.modeEnv.royaleMode then
|
if GAME.modeEnv.royaleMode then
|
||||||
local v=P.swappingAtkMode
|
local v=P.swappingAtkMode
|
||||||
if P.keyPressing[9]then
|
local tar=#P.field>15 and 4 or 8
|
||||||
P.swappingAtkMode=min(v+2,30)
|
if v~=tar then
|
||||||
else
|
P.swappingAtkMode=v+(v<tar and 1 or -1)
|
||||||
local tar=#P.field>15 and 4 or 8
|
|
||||||
if v~=tar then
|
|
||||||
P.swappingAtkMode=v+(v<tar and 1 or -1)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -2042,7 +2045,7 @@ local function update_alive(P)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Drop pressed
|
--Drop pressed
|
||||||
if P.keyPressing[7]and not P.keyPressing[9]then
|
if P.keyPressing[7]then
|
||||||
P.downing=P.downing+1
|
P.downing=P.downing+1
|
||||||
local d=P.downing-ENV.sddas
|
local d=P.downing-ENV.sddas
|
||||||
if d>1 then
|
if d>1 then
|
||||||
@@ -2116,9 +2119,8 @@ local function update_alive(P)
|
|||||||
|
|
||||||
if P.ghoY~=P.curY then
|
if P.ghoY~=P.curY then
|
||||||
P.dropDelay=ENV.drop
|
P.dropDelay=ENV.drop
|
||||||
elseif P.sound then
|
|
||||||
SFX.play('touch')
|
|
||||||
end
|
end
|
||||||
|
P:checkTouchSound()
|
||||||
else
|
else
|
||||||
P.lockDelay=P.lockDelay-1
|
P.lockDelay=P.lockDelay-1
|
||||||
if P.lockDelay>=0 then
|
if P.lockDelay>=0 then
|
||||||
@@ -2435,12 +2437,7 @@ function Player:act_moveLeft(auto)
|
|||||||
self.ctrlCount=self.ctrlCount+1
|
self.ctrlCount=self.ctrlCount+1
|
||||||
end
|
end
|
||||||
self.movDir=-1
|
self.movDir=-1
|
||||||
if self.keyPressing[9]then
|
if self.control and self.waiting==-1 then
|
||||||
if self.gameEnv.swap then
|
|
||||||
self:changeAtkMode(1)
|
|
||||||
self.keyPressing[1]=false
|
|
||||||
end
|
|
||||||
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
|
||||||
self:createMoveFX('left')
|
self:createMoveFX('left')
|
||||||
self.curX=self.curX-1
|
self.curX=self.curX-1
|
||||||
@@ -2461,12 +2458,7 @@ function Player:act_moveRight(auto)
|
|||||||
self.ctrlCount=self.ctrlCount+1
|
self.ctrlCount=self.ctrlCount+1
|
||||||
end
|
end
|
||||||
self.movDir=1
|
self.movDir=1
|
||||||
if self.keyPressing[9]then
|
if self.control and self.waiting==-1 then
|
||||||
if self.gameEnv.swap then
|
|
||||||
self:changeAtkMode(2)
|
|
||||||
self.keyPressing[2]=false
|
|
||||||
end
|
|
||||||
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
|
||||||
self:createMoveFX('right')
|
self:createMoveFX('right')
|
||||||
self.curX=self.curX+1
|
self.curX=self.curX+1
|
||||||
@@ -2505,12 +2497,7 @@ function Player:act_rot180()
|
|||||||
end
|
end
|
||||||
function Player:act_hardDrop()
|
function Player:act_hardDrop()
|
||||||
local ENV=self.gameEnv
|
local ENV=self.gameEnv
|
||||||
if self.keyPressing[9]then
|
if self.control and self.waiting==-1 and self.cur then
|
||||||
if ENV.swap then
|
|
||||||
self:changeAtkMode(3)
|
|
||||||
end
|
|
||||||
self.keyPressing[6]=false
|
|
||||||
elseif self.control and self.waiting==-1 and self.cur then
|
|
||||||
if self.lastPiece.autoLock and self.frameRun-self.lastPiece.frame<ENV.dropcut then
|
if self.lastPiece.autoLock and self.frameRun-self.lastPiece.frame<ENV.dropcut then
|
||||||
SFX.play('drop_cancel',.3)
|
SFX.play('drop_cancel',.3)
|
||||||
else
|
else
|
||||||
@@ -2535,30 +2522,25 @@ function Player:act_hardDrop()
|
|||||||
end
|
end
|
||||||
function Player:act_softDrop()
|
function Player:act_softDrop()
|
||||||
local ENV=self.gameEnv
|
local ENV=self.gameEnv
|
||||||
if self.keyPressing[9]then
|
self.downing=1
|
||||||
if ENV.swap then
|
if self.control and self.waiting==-1 and self.cur then
|
||||||
self:changeAtkMode(4)
|
if self.curY>self.ghoY then
|
||||||
end
|
self.curY=self.curY-1
|
||||||
else
|
self:freshBlock('fresh')
|
||||||
self.downing=1
|
self.spinLast=false
|
||||||
if self.control and self.waiting==-1 and self.cur then
|
self:checkTouchSound()
|
||||||
if self.curY>self.ghoY then
|
elseif ENV.deepDrop then
|
||||||
self.curY=self.curY-1
|
local CB=self.cur.bk
|
||||||
self:freshBlock('fresh')
|
local y=self.curY-1
|
||||||
self.spinLast=false
|
while self:ifoverlap(CB,self.curX,y)and y>0 do
|
||||||
elseif ENV.deepDrop then
|
y=y-1
|
||||||
local CB=self.cur.bk
|
end
|
||||||
local y=self.curY-1
|
if y>0 then
|
||||||
while self:ifoverlap(CB,self.curX,y)and y>0 do
|
self.ghoY=y
|
||||||
y=y-1
|
self:createDropFX()
|
||||||
end
|
self.curY=y
|
||||||
if y>0 then
|
self:freshBlock('move')
|
||||||
self.ghoY=y
|
SFX.play('swipe')
|
||||||
self:createDropFX()
|
|
||||||
self.curY=y
|
|
||||||
self:freshBlock('move')
|
|
||||||
SFX.play('swipe')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2592,7 +2574,7 @@ function Player:act_insLeft(auto)
|
|||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
end
|
end
|
||||||
if self.gameEnv.shakeFX then
|
if self.gameEnv.shakeFX then
|
||||||
self.fieldOff.vx=-.5
|
self.fieldOff.vx=-1.5
|
||||||
end
|
end
|
||||||
if auto then
|
if auto then
|
||||||
if self.ctrlCount==0 then
|
if self.ctrlCount==0 then
|
||||||
@@ -2616,7 +2598,7 @@ function Player:act_insRight(auto)
|
|||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
end
|
end
|
||||||
if self.gameEnv.shakeFX then
|
if self.gameEnv.shakeFX then
|
||||||
self.fieldOff.vx=.5
|
self.fieldOff.vx=1.5
|
||||||
end
|
end
|
||||||
if auto then
|
if auto then
|
||||||
if self.ctrlCount==0 then
|
if self.ctrlCount==0 then
|
||||||
@@ -2637,6 +2619,7 @@ function Player:act_insDown()
|
|||||||
self.lockDelay=ENV.lock
|
self.lockDelay=ENV.lock
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
self:freshBlock('fresh')
|
self:freshBlock('fresh')
|
||||||
|
self:checkTouchSound()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player:act_down1()
|
function Player:act_down1()
|
||||||
|
|||||||
Reference in New Issue
Block a user