场地晃动改名swing
添加场地抖动特效(跟场地晃动使用同一个设置值)
This commit is contained in:
@@ -119,8 +119,15 @@ local function _stencilBoard()gc_rectangle('fill',0,-10,300,610)end
|
|||||||
local function _applyField(P)
|
local function _applyField(P)
|
||||||
gc_push('transform')
|
gc_push('transform')
|
||||||
|
|
||||||
--Apply fieldOffset
|
--Apply shaking
|
||||||
local O=P.fieldOff
|
if P.shakeTimer>0 then
|
||||||
|
local dx=int(P.shakeTimer/2)
|
||||||
|
local dy=int(P.shakeTimer/3)
|
||||||
|
gc_translate(dx^1.6*(dx%2*2-1)*(P.gameEnv.shakeFX+1)/30,dy^1.4*(dy%2*2-1)*(P.gameEnv.shakeFX+1)/30)
|
||||||
|
end
|
||||||
|
|
||||||
|
--Apply swingOffset
|
||||||
|
local O=P.swingOffset
|
||||||
if P.gameEnv.shakeFX then
|
if P.gameEnv.shakeFX then
|
||||||
local k=P.gameEnv.shakeFX
|
local k=P.gameEnv.shakeFX
|
||||||
gc_translate(O.x*k+150+150,O.y*k+300)
|
gc_translate(O.x*k+150+150,O.y*k+300)
|
||||||
|
|||||||
@@ -102,11 +102,12 @@ local function _newEmptyPlayer(id,mini)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Field position
|
--Field position
|
||||||
P.fieldOff={--Shake FX
|
P.swingOffset={--Shake FX
|
||||||
x=0,y=0,
|
x=0,y=0,
|
||||||
vx=0,vy=0,
|
vx=0,vy=0,
|
||||||
a=0,va=0,
|
a=0,va=0,
|
||||||
}
|
}
|
||||||
|
P.shakeTimer=0
|
||||||
P.x,P.y,P.size=0,0,1
|
P.x,P.y,P.size=0,0,1
|
||||||
P.frameColor=COLOR.Z
|
P.frameColor=COLOR.Z
|
||||||
|
|
||||||
|
|||||||
@@ -33,12 +33,17 @@ end
|
|||||||
function Player:_rotateField(dir)
|
function Player:_rotateField(dir)
|
||||||
if self.gameEnv.shakeFX then
|
if self.gameEnv.shakeFX then
|
||||||
if dir==1 or dir==3 then
|
if dir==1 or dir==3 then
|
||||||
self.fieldOff.va=self.fieldOff.va+(2-dir)*6e-3
|
self.swingOffset.va=self.swingOffset.va+(2-dir)*6e-3
|
||||||
else
|
else
|
||||||
self.fieldOff.va=self.fieldOff.va+self:getCenterX()*3e-3
|
self.swingOffset.va=self.swingOffset.va+self:getCenterX()*3e-3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function Player:shakeField(strength)--Range: 1~10
|
||||||
|
if self.gameEnv.shakeFX then
|
||||||
|
self.shakeTimer=max(self.shakeTimer,3*self.gameEnv.shakeFX+int(4*min(max(strength,1),10)))
|
||||||
|
end
|
||||||
|
end
|
||||||
function Player:checkTouchSound()
|
function Player:checkTouchSound()
|
||||||
if self.sound and self.curY==self.ghoY then
|
if self.sound and self.curY==self.ghoY then
|
||||||
SFX.play('touch')
|
SFX.play('touch')
|
||||||
@@ -153,7 +158,7 @@ function Player:createSplashFX(h)
|
|||||||
if self.gameEnv.splashFX then
|
if self.gameEnv.splashFX then
|
||||||
local L=self.field[h]
|
local L=self.field[h]
|
||||||
local size=self.size
|
local size=self.size
|
||||||
local y=self.fieldY+size*(self.fieldOff.y+self.fieldBeneath+self.fieldUp+615)-30*h*size
|
local y=self.fieldY+size*(self.swingOffset.y+self.fieldBeneath+self.fieldUp+615)-30*h*size
|
||||||
for x=1,10 do
|
for x=1,10 do
|
||||||
local c=L[x]
|
local c=L[x]
|
||||||
if c>0 then
|
if c>0 then
|
||||||
@@ -577,7 +582,7 @@ function Player:freshBlock(mode)--string mode: push/move/fresh/newBlock
|
|||||||
if self.curY>self.ghoY then
|
if self.curY>self.ghoY then
|
||||||
self:createDropFX()
|
self:createDropFX()
|
||||||
if ENV.shakeFX then
|
if ENV.shakeFX then
|
||||||
self.fieldOff.vy=.5
|
self.swingOffset.vy=.5
|
||||||
end
|
end
|
||||||
self.curY=self.ghoY
|
self.curY=self.ghoY
|
||||||
end
|
end
|
||||||
@@ -810,7 +815,7 @@ function Player:spin(d,ifpre)
|
|||||||
self.freshTime=self.freshTime-1
|
self.freshTime=self.freshTime-1
|
||||||
end
|
end
|
||||||
|
|
||||||
--Sound & Field shaking
|
--Sound & Field swinging
|
||||||
local sfx
|
local sfx
|
||||||
if ifpre then
|
if ifpre then
|
||||||
sfx='prerotate'
|
sfx='prerotate'
|
||||||
@@ -1853,9 +1858,9 @@ local function _updateMisc(P)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--Field shaking
|
--Field swinging
|
||||||
if P.gameEnv.shakeFX then
|
if P.gameEnv.shakeFX then
|
||||||
local O=P.fieldOff
|
local O=P.swingOffset
|
||||||
O.vx=O.vx*.6-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
|
||||||
|
|
||||||
@@ -1869,6 +1874,11 @@ local function _updateMisc(P)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Field Shaking
|
||||||
|
if P.shakeTimer>0 then
|
||||||
|
P.shakeTimer=P.shakeTimer-1
|
||||||
|
end
|
||||||
|
|
||||||
--Update texts
|
--Update texts
|
||||||
if P.bonus then
|
if P.bonus then
|
||||||
TEXT.update(1/60,P.bonus)
|
TEXT.update(1/60,P.bonus)
|
||||||
@@ -2001,7 +2011,7 @@ local function update_alive(P)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
|
if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
|
||||||
P.fieldOff.vx=.5
|
P.swingOffset.vx=.5
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
P.movDir=0
|
P.movDir=0
|
||||||
@@ -2026,7 +2036,7 @@ local function update_alive(P)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
||||||
P.fieldOff.vx=-.5
|
P.swingOffset.vx=-.5
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
P.movDir=0
|
P.movDir=0
|
||||||
@@ -2057,7 +2067,7 @@ local function update_alive(P)
|
|||||||
P:act_insDown()
|
P:act_insDown()
|
||||||
end
|
end
|
||||||
if ENV.shakeFX then
|
if ENV.shakeFX then
|
||||||
P.fieldOff.vy=.2
|
P.swingOffset.vy=.2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -2511,8 +2521,8 @@ function Player:act_hardDrop()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if ENV.shakeFX then
|
if ENV.shakeFX then
|
||||||
self.fieldOff.vy=.6
|
self.swingOffset.vy=.6
|
||||||
self.fieldOff.va=self.fieldOff.va+self:getCenterX()*6e-4
|
self.swingOffset.va=self.swingOffset.va+self:getCenterX()*6e-4
|
||||||
end
|
end
|
||||||
self.lockDelay=-1
|
self.lockDelay=-1
|
||||||
self:drop()
|
self:drop()
|
||||||
@@ -2574,7 +2584,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=-1.5
|
self.swingOffset.vx=-1.5
|
||||||
end
|
end
|
||||||
if auto then
|
if auto then
|
||||||
if self.ctrlCount==0 then
|
if self.ctrlCount==0 then
|
||||||
@@ -2598,7 +2608,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=1.5
|
self.swingOffset.vx=1.5
|
||||||
end
|
end
|
||||||
if auto then
|
if auto then
|
||||||
if self.ctrlCount==0 then
|
if self.ctrlCount==0 then
|
||||||
@@ -2613,7 +2623,7 @@ function Player:act_insDown()
|
|||||||
local ENV=self.gameEnv
|
local ENV=self.gameEnv
|
||||||
self:createDropFX()
|
self:createDropFX()
|
||||||
if ENV.shakeFX then
|
if ENV.shakeFX then
|
||||||
self.fieldOff.vy=.5
|
self.swingOffset.vy=.5
|
||||||
end
|
end
|
||||||
self.curY=self.ghoY
|
self.curY=self.ghoY
|
||||||
self.lockDelay=ENV.lock
|
self.lockDelay=ENV.lock
|
||||||
|
|||||||
Reference in New Issue
Block a user