整理旋转相关代码,希望能进一步解决神秘的旋转时报错问题
This commit is contained in:
@@ -678,26 +678,26 @@ function Player:spin(d,ifpre)
|
|||||||
end
|
end
|
||||||
local icb=BLOCKS[cur.id][idir]
|
local icb=BLOCKS[cur.id][idir]
|
||||||
local isc=self.RS.centerPos[cur.id][idir]
|
local isc=self.RS.centerPos[cur.id][idir]
|
||||||
local ix,iy=self.curX+cur.sc[2]-isc[2],self.curY+cur.sc[1]-isc[1]
|
local baseX,baseY=self.curX+cur.sc[2]-isc[2],self.curY+cur.sc[1]-isc[1]
|
||||||
for test=1,#kickData do
|
for test=1,#kickData do
|
||||||
local x,y=ix+kickData[test][1],iy+kickData[test][2]
|
local ix,iy=baseX+kickData[test][1],baseY+kickData[test][2]
|
||||||
if (self.freshTime>0 or kickData[test][2]<=0)and not self:ifoverlap(icb,x,y)then
|
if (self.freshTime>0 or kickData[test][2]<=0)and not self:ifoverlap(icb,ix,iy)then
|
||||||
ix,iy=x,y
|
--Create moveFX at the original position
|
||||||
if self.gameEnv.moveFX and self.gameEnv.block then
|
if self.gameEnv.moveFX and self.gameEnv.block then self:createMoveFX()end
|
||||||
self:createMoveFX()
|
|
||||||
end
|
--Change block position
|
||||||
self.curX,self.curY,cur.dir=ix,iy,idir
|
cur.sc,cur.bk,cur.dir=isc,icb,idir
|
||||||
cur.sc,cur.bk=isc,icb
|
self.curX,self.curY=ix,iy
|
||||||
self.spinLast=test==2 and 0 or 1
|
self.spinLast=test==2 and 0 or 1
|
||||||
|
|
||||||
|
--Fresh ghost and freshTime
|
||||||
local t=self.freshTime
|
local t=self.freshTime
|
||||||
if not ifpre then
|
if not ifpre then self:freshBlock('move')end
|
||||||
self:freshBlock('move')
|
|
||||||
end
|
|
||||||
if kickData[test][2]>0 and self.freshTime==t and self.curY~=self.imgY then
|
if kickData[test][2]>0 and self.freshTime==t and self.curY~=self.imgY then
|
||||||
self.freshTime=self.freshTime-1
|
self.freshTime=self.freshTime-1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Sound & Field shaking
|
||||||
if self.sound then
|
if self.sound then
|
||||||
local sfx
|
local sfx
|
||||||
if ifpre then
|
if ifpre then
|
||||||
|
|||||||
Reference in New Issue
Block a user