整理场地晃动相关代码

This commit is contained in:
MrZ626
2021-08-21 01:56:29 +08:00
parent 02c4655f0d
commit 961cf347da
4 changed files with 21 additions and 16 deletions

View File

@@ -631,9 +631,9 @@ do
sfx='rotatekick'
if P.gameEnv.shakeFX then
if d==1 or d==3 then
P.fieldOff.va=P.fieldOff.va+(2-d)*P.gameEnv.shakeFX*6e-3
P.fieldOff.va=P.fieldOff.va+(2-d)*6e-3
else
P.fieldOff.va=P.fieldOff.va+P:getCenterX()*P.gameEnv.shakeFX*3e-3
P.fieldOff.va=P.fieldOff.va+P:getCenterX()*3e-3
end
end
else

View File

@@ -80,9 +80,14 @@ local function applyField(P)
--Apply fieldOffset
local O=P.fieldOff
gc_translate(O.x+150+150,O.y+300)
gc_rotate(O.a)
gc_translate(-150,-300)
if P.gameEnv.shakeFX then
local k=P.gameEnv.shakeFX
gc_translate(O.x*k+150+150,O.y*k+300)
gc_rotate(O.a*k)
gc_translate(-150,-300)
else
gc_translate(150,0)
end
--Apply stencil
gc_stencil(stencilBoard)

View File

@@ -478,7 +478,7 @@ function Player:freshBlock(mode)--string mode: push/move/fresh/newBlock
self:createDropFX(self.curX,self.curY-1,#CB[1],self.curY-self.ghoY-#CB+1)
end
if ENV.shakeFX then
self.fieldOff.vy=ENV.shakeFX*.5
self.fieldOff.vy=.5
end
self.curY=self.ghoY
end
@@ -705,9 +705,9 @@ function Player:spin(d,ifpre)
sfx='rotatekick'
if self.gameEnv.shakeFX then
if d==1 or d==3 then
self.fieldOff.va=self.fieldOff.va+(2-d)*self.gameEnv.shakeFX*6e-3
self.fieldOff.va=self.fieldOff.va+(2-d)*6e-3
else
self.fieldOff.va=self.fieldOff.va+self:getCenterX()*self.gameEnv.shakeFX*3e-3
self.fieldOff.va=self.fieldOff.va+self:getCenterX()*3e-3
end
end
else
@@ -1891,8 +1891,8 @@ function Player:act_hardDrop()
end
end
if ENV.shakeFX then
self.fieldOff.vy=ENV.shakeFX*.6
self.fieldOff.va=self.fieldOff.va+self:getCenterX()*ENV.shakeFX*6e-4
self.fieldOff.vy=.6
self.fieldOff.va=self.fieldOff.va+self:getCenterX()*6e-4
end
self.lockDelay=-1
self:drop()
@@ -1960,7 +1960,7 @@ function Player:act_insLeft(auto)
self.spinLast=false
end
if self.gameEnv.shakeFX then
self.fieldOff.vx=-self.gameEnv.shakeFX*.5
self.fieldOff.vx=-.5
end
if auto then
if self.ctrlCount==0 then self.ctrlCount=1 end
@@ -1982,7 +1982,7 @@ function Player:act_insRight(auto)
self.spinLast=false
end
if self.gameEnv.shakeFX then
self.fieldOff.vx=self.gameEnv.shakeFX*.5
self.fieldOff.vx=.5
end
if auto then
if self.ctrlCount==0 then self.ctrlCount=1 end
@@ -1998,7 +1998,7 @@ function Player:act_insDown()
self:createDropFX(self.curX,self.curY-1,#CB[1],self.curY-self.ghoY-#CB+1)
end
if ENV.shakeFX then
self.fieldOff.vy=ENV.shakeFX*.5
self.fieldOff.vy=.5
end
self.curY=self.ghoY
self.lockDelay=ENV.lock

View File

@@ -237,7 +237,7 @@ function update.alive(P,dt)
end
end
if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
P.fieldOff.vx=ENV.shakeFX*.5
P.fieldOff.vx=.5
end
else
P.movDir=0
@@ -262,7 +262,7 @@ function update.alive(P,dt)
end
end
if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
P.fieldOff.vx=-ENV.shakeFX*.5
P.fieldOff.vx=-.5
end
else
P.movDir=0
@@ -293,7 +293,7 @@ function update.alive(P,dt)
P:act_insDown()
end
if ENV.shakeFX then
P.fieldOff.vy=ENV.shakeFX*.2
P.fieldOff.vy=.2
end
end
else