整 理 代 码
(应该没有改到字符串里面的东西吧…)起码不直接影响运行
This commit is contained in:
@@ -39,14 +39,14 @@ local modeSelector=WIDGET.newSelector{name='mode',x=150,y=220,w=290,
|
||||
"Dense_Handstream",
|
||||
"Light_Quadstream",
|
||||
"Quadstream",
|
||||
},disp=function()return mode end,code=function(m)mode=m reset()end
|
||||
},disp=function() return mode end,code=function(m) mode=m reset() end
|
||||
}
|
||||
local bgmSelector=WIDGET.newSelector{name='bgm',x=150,y=290,w=290,list=BGM.getList(),disp=function()return bgm end,code=function(i)bgm=i BGM.play(i)end}
|
||||
local bgmSelector=WIDGET.newSelector{name='bgm',x=150,y=290,w=290,list=BGM.getList(),disp=function() return bgm end,code=function(i) bgm=i BGM.play(i) end}
|
||||
local colorSelector=WIDGET.newSelector{name='color',x=150,y=360,w=290,
|
||||
list={"black","dGray","gray","lGray","dRed","red","lRed","dFire","fire","lFire","dOrange","orange","lOrange","dYellow","yellow","lYellow","dLime","lime","lLime","dJade","jade","lJade","dGreen","green","lGreen","dAqua","aqua","lAqua","dCyan","cyan","lCyan","dNavy","navy","lNavy","dSea","sea","lSea","dBlue","blue","lBlue","dViolet","violet","lViolet","dPurple","purple","lPurple","dMagenta","magenta","lMagenta","dWine","wine","lWine"},
|
||||
disp=function()return tileColor end,code=function(m)tileColor=m end
|
||||
disp=function() return tileColor end,code=function(m) tileColor=m end
|
||||
}
|
||||
local arcadeSwitch=WIDGET.newSwitch{name='arcade',x=240,y=430,lim=200,font=40,disp=function()return arcade end,code=pressKey'e'}
|
||||
local arcadeSwitch=WIDGET.newSwitch{name='arcade',x=240,y=430,lim=200,font=40,disp=function() return arcade end,code=pressKey'e'}
|
||||
local function freshSelectors()
|
||||
local f=state~=0
|
||||
modeSelector.hide=f
|
||||
@@ -66,7 +66,7 @@ local function get1(prev)
|
||||
else
|
||||
while true do
|
||||
local r=rnd(4)
|
||||
if not string.find(prev,r)then return r end
|
||||
if not string.find(prev,r) then return r end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -75,13 +75,13 @@ local function get2(prev)
|
||||
local i=rnd(4)
|
||||
local r=rnd(3)
|
||||
if r>=i then r=r+1 end
|
||||
if not(string.find(prev,r)or string.find(prev,i))then
|
||||
if not (string.find(prev,r) or string.find(prev,i)) then
|
||||
return 10*i+r
|
||||
end
|
||||
end
|
||||
end
|
||||
local function get3(prev)
|
||||
if prev==0 then prev=rnd(4)end
|
||||
if prev==0 then prev=rnd(4) end
|
||||
if prev==1 then return 234
|
||||
elseif prev==2 then return 134
|
||||
elseif prev==3 then return 124
|
||||
@@ -95,22 +95,22 @@ local generator={
|
||||
ins(pos,rnd(4))
|
||||
end,
|
||||
Split=function()
|
||||
if #pos==0 then ins(pos,rnd(4))end
|
||||
ins(pos,pos[#pos]<=2 and rnd(3,4)or rnd(2))
|
||||
if #pos==0 then ins(pos,rnd(4)) end
|
||||
ins(pos,pos[#pos]<=2 and rnd(3,4) or rnd(2))
|
||||
end,
|
||||
Short=function()
|
||||
if #pos<2 then ins(pos,rnd(4))ins(pos,rnd(4))end
|
||||
if #pos<2 then ins(pos,rnd(4))ins(pos,rnd(4)) end
|
||||
local r
|
||||
if pos[#pos]==pos[#pos-1]then
|
||||
if pos[#pos]==pos[#pos-1] then
|
||||
r=rnd(3)
|
||||
if r>=pos[#pos]then r=r+1 end
|
||||
if r>=pos[#pos] then r=r+1 end
|
||||
ins(pos,r)
|
||||
else
|
||||
ins(pos,rnd(4))
|
||||
end
|
||||
end,
|
||||
Stairs=function()
|
||||
local r=get1(pos[#pos]or 0)
|
||||
local r=get1(pos[#pos] or 0)
|
||||
local dir=r==1 and 1 or r==4 and -1 or rnd()<.5 and 1 or -1
|
||||
local count=rnd(3,5)
|
||||
while count>0 do
|
||||
@@ -132,48 +132,48 @@ local generator={
|
||||
ins(pos,r)
|
||||
end,
|
||||
Singlestream=function()
|
||||
ins(pos,get1(pos[#pos]or 0))
|
||||
ins(pos,get1(pos[#pos] or 0))
|
||||
end,
|
||||
Light_Jumpstream=function()--2111
|
||||
ins(pos,get2(pos[#pos]or 0))
|
||||
ins(pos,get2(pos[#pos] or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Dense_Jumpstream=function()--2121
|
||||
ins(pos,get2(pos[#pos]or 0))
|
||||
ins(pos,get2(pos[#pos] or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get2(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Light_Handstream=function()--3111
|
||||
ins(pos,get3(pos[#pos]or 0))
|
||||
ins(pos,get3(pos[#pos] or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Dense_Handstream=function()--3121
|
||||
ins(pos,get3(pos[#pos]or 0))
|
||||
ins(pos,get3(pos[#pos] or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get2(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Light_Quadstream=function()--4111
|
||||
ins(pos,1234)
|
||||
ins(pos,get1(pos[#pos-1]or 0))
|
||||
ins(pos,get1(pos[#pos-1] or 0))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
Quadstream=function()--4121
|
||||
ins(pos,1234)
|
||||
ins(pos,get1(pos[#pos-1]or 0))
|
||||
ins(pos,get1(pos[#pos-1] or 0))
|
||||
ins(pos,get2(pos[#pos]))
|
||||
ins(pos,get1(pos[#pos]))
|
||||
end,
|
||||
}
|
||||
|
||||
function reset()
|
||||
keyTime={}for i=1,40 do keyTime[i]=-1e99 end
|
||||
keyTime={} for i=1,40 do keyTime[i]=-1e99 end
|
||||
speed,maxSpeed=0,0
|
||||
progress={}
|
||||
state=0
|
||||
@@ -182,15 +182,15 @@ function reset()
|
||||
score=0
|
||||
|
||||
local t=love.system.getClipboardText()
|
||||
if type(t)=='string'then
|
||||
if type(t)=='string' then
|
||||
t=t:lower():match("^s=(.+)")
|
||||
t=t and tonumber(t)and tonumber(t)*2
|
||||
t=t and tonumber(t) and tonumber(t)*2
|
||||
t=t and tonumber(t)>=0 and tonumber(t)<=60 and t
|
||||
end
|
||||
rollSpeed=type(t)=='number'and t or 6.26
|
||||
rollSpeed=type(t)=='number' and t or 6.26
|
||||
|
||||
pos={}
|
||||
while #pos<7 do generator[mode]()end
|
||||
while #pos<7 do generator[mode]() end
|
||||
height=0
|
||||
diePos=false
|
||||
end
|
||||
@@ -218,11 +218,11 @@ local function touch(n)
|
||||
SFX.play('lock')
|
||||
else
|
||||
rem(pos,1)
|
||||
while #pos<7 do generator[mode]()end
|
||||
while #pos<7 do generator[mode]() end
|
||||
ins(keyTime,1,TIME())
|
||||
keyTime[21]=nil
|
||||
score=score+1
|
||||
if not arcade and targets[score]then
|
||||
if not arcade and targets[score] then
|
||||
ins(progress,("%s - %.3fs"):format(score,TIME()-startTime))
|
||||
if score==2600 then
|
||||
for i=1,#pos do
|
||||
@@ -247,23 +247,23 @@ local function touch(n)
|
||||
end
|
||||
function scene.keyDown(key,isRep)
|
||||
if isRep then return end
|
||||
if key=='r'or key=='space'then reset()
|
||||
elseif key=='escape'then SCN.back()
|
||||
if key=='r' or key=='space' then reset()
|
||||
elseif key=='escape' then SCN.back()
|
||||
elseif state~=2 then
|
||||
if key=='d'or key=='c'then touch(1)
|
||||
elseif key=='f'or key=='v'then touch(2)
|
||||
elseif key=='j'or key=='n'then touch(3)
|
||||
elseif key=='k'or key=='m'then touch(4)
|
||||
if key=='d' or key=='c' then touch(1)
|
||||
elseif key=='f' or key=='v' then touch(2)
|
||||
elseif key=='j' or key=='n' then touch(3)
|
||||
elseif key=='k' or key=='m' then touch(4)
|
||||
elseif state==0 then
|
||||
if key=='tab'then
|
||||
if key=='tab' then
|
||||
local mode1=mode
|
||||
modeSelector:scroll(love.keyboard.isDown('lshift','rshift')and -1 or 1)
|
||||
if mode1~=mode then reset()end
|
||||
elseif key=='q'then
|
||||
bgmSelector:scroll(love.keyboard.isDown('lshift','rshift')and -1 or 1)
|
||||
elseif key=='w'then
|
||||
colorSelector:scroll(love.keyboard.isDown('lshift','rshift')and -1 or 1)
|
||||
elseif key=='e'then
|
||||
modeSelector:scroll(love.keyboard.isDown('lshift','rshift') and -1 or 1)
|
||||
if mode1~=mode then reset() end
|
||||
elseif key=='q' then
|
||||
bgmSelector:scroll(love.keyboard.isDown('lshift','rshift') and -1 or 1)
|
||||
elseif key=='w' then
|
||||
colorSelector:scroll(love.keyboard.isDown('lshift','rshift') and -1 or 1)
|
||||
elseif key=='e' then
|
||||
arcade=not arcade
|
||||
end
|
||||
end
|
||||
@@ -285,7 +285,7 @@ function scene.update(dt)
|
||||
local t=TIME()
|
||||
time=t-startTime
|
||||
local v=0
|
||||
for i=2,20 do v=v+i*(i-1)*.3/(t-keyTime[i])end
|
||||
for i=2,20 do v=v+i*(i-1)*.3/(t-keyTime[i]) end
|
||||
speed=MATH.expApproach(speed,v,dt)
|
||||
if speed>maxSpeed then maxSpeed=speed end
|
||||
|
||||
@@ -302,7 +302,7 @@ function scene.update(dt)
|
||||
end
|
||||
end
|
||||
|
||||
local function boardStencil()gc.rectangle('fill',300,0,680,720)end
|
||||
local function boardStencil() gc.rectangle('fill',300,0,680,720) end
|
||||
function scene.draw()
|
||||
setFont(50)
|
||||
if arcade then
|
||||
|
||||
Reference in New Issue
Block a user