调整场地晃动强度

This commit is contained in:
MrZ626
2021-03-25 18:09:37 +08:00
parent fac14772f5
commit 347729a26e
2 changed files with 24 additions and 14 deletions

View File

@@ -5,7 +5,7 @@
local Player={}--Player class
local int,ceil,rnd=math.floor,math.ceil,math.random
local max,min,modf=math.max,math.min,math.modf
local max,min,abs,modf=math.max,math.min,math.abs,math.modf
local ins,rem=table.insert,table.remove
local resume,yield=coroutine.resume,coroutine.yield
@@ -462,7 +462,6 @@ function Player.freshBlock(P,mode)--string mode: push/move/fresh/newBlock
end
if ENV.shakeFX then
P.fieldOff.vy=ENV.shakeFX*.5
P.fieldOff.va=P:getCenterX()*P.gameEnv.shakeFX*5e-4
end
P.curY=P.ghoY
end
@@ -609,7 +608,20 @@ function Player.spin(P,d,ifpre)
end
if P.sound then
SFX.play(ifpre and"prerotate"or P:ifoverlap(P.cur.bk,P.curX,P.curY+1)and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)and"rotatekick"or"rotate",nil,P:getCenterX()*.15)
local sfx
if ifpre then
sfx="prerotate"
elseif P:ifoverlap(icb,ix,iy+1)and P:ifoverlap(icb,ix-1,iy)and P:ifoverlap(icb,ix+1,iy)then
sfx="rotatekick"
if abs(d)==1 then
P.fieldOff.va=P.fieldOff.va+d*P.gameEnv.shakeFX*6e-3
else
P.fieldOff.va=P.fieldOff.va+P:getCenterX()*P.gameEnv.shakeFX*3e-3
end
else
sfx="rotate"
end
SFX.play(sfx,nil,P:getCenterX()*.15)
end
P.stat.rotate=P.stat.rotate+1
return
@@ -1877,7 +1889,7 @@ end
function Player.act_rotLeft(P)
if P.control and P.waiting==-1 and P.cur then
P.ctrlCount=P.ctrlCount+1
P:spin(3)
P:spin(-1)
P.keyPressing[4]=false
end
end
@@ -1902,15 +1914,15 @@ function Player.act_hardDrop(P)
end
P.curY=P.ghoY
P.spinLast=false
if P.gameEnv.shakeFX then
P.fieldOff.vy=P.gameEnv.shakeFX*.6
P.fieldOff.va=P:getCenterX()*P.gameEnv.shakeFX*6e-4
end
if P.sound then
SFX.play("drop",nil,P:getCenterX()*.15)
VIB(1)
end
end
if P.gameEnv.shakeFX then
P.fieldOff.vy=P.gameEnv.shakeFX*.6
P.fieldOff.va=P.fieldOff.va+P:getCenterX()*P.gameEnv.shakeFX*6e-4
end
P.lockDelay=-1
P:drop()
P.keyPressing[6]=false
@@ -2012,7 +2024,7 @@ function Player.act_insDown(P)
end
if ENV.shakeFX then
P.fieldOff.vy=ENV.shakeFX*.5
P.fieldOff.va=P:getCenterX()*P.gameEnv.shakeFX*5e-4
-- P.fieldOff.va=P.fieldOff.va+P:getCenterX()*P.gameEnv.shakeFX*5e-4
end
P.curY=P.ghoY
P.lockDelay=ENV.lock

View File

@@ -85,15 +85,13 @@ local function updateFXs(P,dt)
--Field shaking
if P.gameEnv.shakeFX then
local O=P.fieldOff
O.vx=O.vx*.8-abs(O.x)^1.2*(O.x>0 and .1 or -.1)
O.vx=O.vx*.8-abs(O.x)^1.3*(O.x>0 and .1 or -.1)
O.x=O.x+O.vx
if abs(O.x)<.3 then O.x,O.vx=0,0 end
O.vy=O.vy*.8-abs(O.y)^1.2*(O.y>0 and .1 or -.1)
O.y=O.y+O.vy
if abs(O.y)<.3 then O.y,O.vy=0,0 end
O.va=O.va*.8-abs(O.a)^1.2*(O.a>0 and .1 or -.1)
O.va=O.va*.8-abs(O.a)^1.4*(O.a>0 and .08 or -.08)
O.a=O.a+O.va
-- if abs(O.a)<.3 then O.a,O.va=0,0 end
end
@@ -255,7 +253,7 @@ function update.alive(P,dt)
end
if ENV.shakeFX then
P.fieldOff.vy=ENV.shakeFX*.2
P.fieldOff.va=P:getCenterX()*P.gameEnv.shakeFX*2e-4
P.fieldOff.va=P.fieldOff.va+P:getCenterX()*P.gameEnv.shakeFX*4e-5
end
end
else