别踩白块小程序增加双押功能,添加两个有双押的模式
This commit is contained in:
@@ -29,6 +29,8 @@ local tileColor={
|
|||||||
COLOR.dG,
|
COLOR.dG,
|
||||||
COLOR.dB,
|
COLOR.dB,
|
||||||
COLOR.dY,
|
COLOR.dY,
|
||||||
|
COLOR.dSky,
|
||||||
|
COLOR.dPurple,
|
||||||
}
|
}
|
||||||
local modeName={
|
local modeName={
|
||||||
"Normal",
|
"Normal",
|
||||||
@@ -36,6 +38,8 @@ local modeName={
|
|||||||
"Mess",
|
"Mess",
|
||||||
"Short",
|
"Short",
|
||||||
"Stairs",
|
"Stairs",
|
||||||
|
"Double",
|
||||||
|
"Mixed",
|
||||||
}
|
}
|
||||||
local mode=1
|
local mode=1
|
||||||
local score
|
local score
|
||||||
@@ -65,6 +69,24 @@ local function newTile()
|
|||||||
elseif r>4 then
|
elseif r>4 then
|
||||||
r=r-2
|
r=r-2
|
||||||
end
|
end
|
||||||
|
elseif mode==6 then
|
||||||
|
local i=rnd(4)
|
||||||
|
r=rnd(3)
|
||||||
|
if r>=i then
|
||||||
|
r=r+1
|
||||||
|
end
|
||||||
|
r=10*i+r
|
||||||
|
elseif mode==7 then
|
||||||
|
if rnd()<.126 then
|
||||||
|
local i=rnd(4)
|
||||||
|
r=rnd(3)
|
||||||
|
if r>=i then
|
||||||
|
r=r+1
|
||||||
|
end
|
||||||
|
r=10*i+r
|
||||||
|
else
|
||||||
|
r=rnd(4)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
ins(pos,r)
|
ins(pos,r)
|
||||||
end
|
end
|
||||||
@@ -98,27 +120,33 @@ local function touch(n)
|
|||||||
state=1
|
state=1
|
||||||
startTime=TIME()
|
startTime=TIME()
|
||||||
end
|
end
|
||||||
if n==pos[1]then
|
local a,b=pos[1]%10,int(pos[1]/10)
|
||||||
rem(pos,1)
|
if n==a or n==b then
|
||||||
newTile()
|
if a>0 and b>0 then
|
||||||
ins(keyTime,1,TIME())
|
pos[1]=n==a and b or a
|
||||||
keyTime[21]=nil
|
SFX.play("move")
|
||||||
score=score+1
|
else
|
||||||
if targets[score]then
|
rem(pos,1)
|
||||||
ins(progress,format("%s - %.3fs",score,TIME()-startTime))
|
newTile()
|
||||||
if score==26000 then
|
ins(keyTime,1,TIME())
|
||||||
for i=1,#pos do
|
keyTime[21]=nil
|
||||||
pos[i]=626
|
score=score+1
|
||||||
|
if targets[score]then
|
||||||
|
ins(progress,format("%s - %.3fs",score,TIME()-startTime))
|
||||||
|
if score==26000 then
|
||||||
|
for i=1,#pos do
|
||||||
|
pos[i]=626
|
||||||
|
end
|
||||||
|
time=TIME()-startTime
|
||||||
|
state=2
|
||||||
|
SFX.play("win")
|
||||||
|
else
|
||||||
|
SFX.play("reach",.5)
|
||||||
end
|
end
|
||||||
time=TIME()-startTime
|
|
||||||
state=2
|
|
||||||
SFX.play("win")
|
|
||||||
else
|
|
||||||
SFX.play("reach",.5)
|
|
||||||
end
|
end
|
||||||
|
height=height+120
|
||||||
|
SFX.play("move")
|
||||||
end
|
end
|
||||||
height=height+120
|
|
||||||
SFX.play("move")
|
|
||||||
else
|
else
|
||||||
time=TIME()-startTime
|
time=TIME()-startTime
|
||||||
state=2
|
state=2
|
||||||
@@ -192,7 +220,12 @@ function scene.draw()
|
|||||||
gc.rectangle("fill",300,0,680,720)
|
gc.rectangle("fill",300,0,680,720)
|
||||||
gc.setColor(tileColor[mode])
|
gc.setColor(tileColor[mode])
|
||||||
for i=1,#pos do
|
for i=1,#pos do
|
||||||
gc.rectangle("fill",130+170*pos[i]+8,720-i*120-height+8,170-16,120-16)
|
if pos[i]<10 then
|
||||||
|
gc.rectangle("fill",130+170*pos[i]+8,720-i*120-height+8,170-16,120-16)
|
||||||
|
else
|
||||||
|
gc.rectangle("fill",130+170*(pos[i]%10)+8,720-i*120-height+8,170-16,120-16)
|
||||||
|
gc.rectangle("fill",130+170*int(pos[i]/10)+8,720-i*120-height+8,170-16,120-16)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--Draw track line
|
--Draw track line
|
||||||
|
|||||||
Reference in New Issue
Block a user