From dd4d2345d31bf0fa528d0d6716701bd1f3309aa3 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Tue, 30 Jan 2024 02:30:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E5=89=8D=E5=9D=97moveY/drop=E6=97=B6?= =?UTF-8?q?=E4=BC=9A=E9=87=8D=E7=BD=AE=E4=B8=8B=E8=90=BD=E8=AE=A1=E6=97=B6?= =?UTF-8?q?=E5=99=A8=20=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/game/minoPlayer.lua | 26 ++++++++++++++------------ assets/game/puyoPlayer.lua | 5 +++-- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/assets/game/minoPlayer.lua b/assets/game/minoPlayer.lua index 22192794..9e712233 100644 --- a/assets/game/minoPlayer.lua +++ b/assets/game/minoPlayer.lua @@ -272,6 +272,7 @@ function MP:getSmoothPos() end -------------------------------------------------------------- -- Game methods +---@param action 'moveX'|'moveY'|'drop'|'rotate'|'reset' function MP:moveHand(action,A,B,C,D) --[[ moveX: dx,noShade @@ -280,10 +281,11 @@ function MP:moveHand(action,A,B,C,D) rotate: x,y,dir,ifInit reset: x,y ]] + local SET=self.settings if action=='moveX' then self.handX=self.handX+A self:checkLanding() - if self.settings.particles then + if SET.particles then local hx,hy=self.handX,self.handY local mat=self.hand.matrix local w,h=#mat[1],#mat @@ -307,8 +309,9 @@ function MP:moveHand(action,A,B,C,D) end elseif action=='moveY' or action=='drop' then self.handY=self.handY+A + self.dropTimer=SET.dropDelay self:checkLanding(true,true) - if self.settings.particles then + if SET.particles then local hx,hy=self.handX,self.handY local mat=self.hand.matrix local w,h=#mat[1],#mat @@ -348,13 +351,13 @@ function MP:moveHand(action,A,B,C,D) if action=='moveX' then if not self.ghostState and - self.settings.tuck and + SET.tuck and self:ifoverlap(self.hand.matrix,self.handX,self.handY-1) and self:ifoverlap(self.hand.matrix,self.handX,self.handY+1) then movement.tuck=true self:playSound('tuck') - if self.settings.particles then + if SET.particles then self:createTuckEffect() end end @@ -362,7 +365,7 @@ function MP:moveHand(action,A,B,C,D) elseif action=='rotate' then if not self.ghostState then if - self.settings.spin_immobile and + SET.spin_immobile and self:ifoverlap(self.hand.matrix,self.handX,self.handY-1) and self:ifoverlap(self.hand.matrix,self.handX,self.handY+1) and self:ifoverlap(self.hand.matrix,self.handX-1,self.handY) and @@ -371,12 +374,12 @@ function MP:moveHand(action,A,B,C,D) movement.immobile=true self:shakeBoard(C=='L' and '-ccw' or C=='R' and '-cw' or '-180') self:playSound('rotate_locked') - if self.settings.particles then + if SET.particles then self:createHandEffect(.942,1,1) end end - if self.settings.spin_corners then - local minoData=minoRotSys[self.settings.rotSys][self.hand.shape] + if SET.spin_corners then + local minoData=minoRotSys[SET.rotSys][self.hand.shape] local state=minoData[self.hand.direction] local centerPos=state and state.center or type(minoData.center)=='function' and minoData.center(self) if centerPos then @@ -387,10 +390,10 @@ function MP:moveHand(action,A,B,C,D) if self.field:getCell(cx+1,cy-1) then corners=corners+1 end if self.field:getCell(cx-1,cy+1) then corners=corners+1 end if self.field:getCell(cx+1,cy+1) then corners=corners+1 end - if corners>=self.settings.spin_corners then + if corners>=SET.spin_corners then movement.corners=true self:playSound('rotate_corners') - if self.settings.particles then + if SET.particles then self:createRotateCornerEffect(cx,cy) end end @@ -399,7 +402,7 @@ function MP:moveHand(action,A,B,C,D) end end self:playSound(D and 'initrotate' or 'rotate') - if self.settings.particles then + if SET.particles then self:createRotateEffect(C,D) end end @@ -1548,7 +1551,6 @@ function MP:updateFrame() if self.dropTimer>0 then self.dropTimer=self.dropTimer-1 if self.dropTimer<=0 then - self.dropTimer=SET.dropDelay self:moveHand('drop',-1,true) end elseif self.handY~=self.ghostY then -- If switch to 20G during game, mino won't dropped to bottom instantly so we force fresh it diff --git a/assets/game/puyoPlayer.lua b/assets/game/puyoPlayer.lua index 678bb66d..2b04ba45 100644 --- a/assets/game/puyoPlayer.lua +++ b/assets/game/puyoPlayer.lua @@ -191,6 +191,7 @@ function PP:getSmoothPos() end -------------------------------------------------------------- -- Game methods +---@param action 'moveX'|'moveY'|'drop'|'rotate'|'reset' function PP:moveHand(action,A,B,C) --[[ moveX: dx,noShade @@ -224,8 +225,9 @@ function PP:moveHand(action,A,B,C) end end end - elseif action=='drop' or action=='moveY' then + elseif action=='moveY' or action=='drop' then self.handY=self.handY+A + self.dropTimer=self.settings.dropDelay self:checkLanding(true) if self.settings.particles then local hx,hy=self.handX,self.handY @@ -1044,7 +1046,6 @@ function PP:updateFrame() if self.dropTimer>0 then self.dropTimer=self.dropTimer-1 if self.dropTimer<=0 then - self.dropTimer=SET.dropDelay self:moveHand('drop',-1,true) end elseif self.handY~=self.ghostY then -- If switch to 20G during game, puyo won't dropped to bottom instantly so we force fresh it