修改Ospin的实现,O的旋转历史不再直接记录在玩家对象里而是放在方块数据中伴随方块刷新自动重置
两种方法各有缺点,暂时选择旋转系统不污染玩家的属性
This commit is contained in:
@@ -174,16 +174,19 @@ do
|
|||||||
end
|
end
|
||||||
if P.gameEnv.ospin then
|
if P.gameEnv.ospin then
|
||||||
local x,y=P.curX,P.curY
|
local x,y=P.curX,P.curY
|
||||||
|
local C=P.cur
|
||||||
if y==P.ghoY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
|
if y==P.ghoY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
|
||||||
if P.sound then
|
if P.sound then
|
||||||
SFX.play('rotatekick',nil,P:getCenterX()*.15)
|
SFX.play('rotatekick',nil,P:getCenterX()*.15)
|
||||||
end
|
end
|
||||||
P.spinSeq=P.spinSeq%100*10+d
|
|
||||||
if P.spinSeq<100 then
|
--[Warning] field spinSeq is a dirty data, TRS put this var into the block.
|
||||||
|
C.spinSeq=(C.spinSeq or 0)%100*10+d
|
||||||
|
if C.spinSeq<100 then
|
||||||
return end
|
return end
|
||||||
for i=1,#OspinList do
|
for i=1,#OspinList do
|
||||||
local L=OspinList[i]
|
local L=OspinList[i]
|
||||||
if P.spinSeq==L[1]then
|
if C.spinSeq==L[1]then
|
||||||
local id,dir=L[2],L[3]
|
local id,dir=L[2],L[3]
|
||||||
local bk=BLOCKS[id][dir]
|
local bk=BLOCKS[id][dir]
|
||||||
x,y=P.curX+L[4],P.curY+L[5]
|
x,y=P.curX+L[4],P.curY+L[5]
|
||||||
@@ -194,15 +197,13 @@ do
|
|||||||
L[6]==2 or(P:ifoverlap(bk,x,y-1)and P:ifoverlap(bk,x,y+1))
|
L[6]==2 or(P:ifoverlap(bk,x,y-1)and P:ifoverlap(bk,x,y+1))
|
||||||
)
|
)
|
||||||
then
|
then
|
||||||
local C=P.cur
|
|
||||||
C.id=id
|
C.id=id
|
||||||
C.bk=bk
|
C.bk=bk
|
||||||
P.curX,P.curY=x,y
|
P.curX,P.curY=x,y
|
||||||
P.cur.dir=dir
|
C.dir=dir
|
||||||
P.spinLast=2
|
P.spinLast=2
|
||||||
P.stat.rotate=P.stat.rotate+1
|
P.stat.rotate=P.stat.rotate+1
|
||||||
P:freshBlock('move')
|
P:freshBlock('move')
|
||||||
P.spinSeq=0
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -211,7 +212,7 @@ do
|
|||||||
if P.sound then
|
if P.sound then
|
||||||
SFX.play('rotate',nil,P:getCenterX()*.15)
|
SFX.play('rotate',nil,P:getCenterX()*.15)
|
||||||
end
|
end
|
||||||
P.spinSeq=0
|
C.spinSeq=nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if P.sound then
|
if P.sound then
|
||||||
|
|||||||
Reference in New Issue
Block a user