新增小游戏:Don't touch white

This commit is contained in:
MrZ626
2021-02-24 01:10:59 +08:00
parent 3a250447b0
commit d62b91659c
10 changed files with 229 additions and 3 deletions

View File

@@ -759,7 +759,7 @@ return{
{"Minigame",
"minigame",
"other",
"Type the following codes in the search bar of this dictionary for some fun minigames!\n\n15-Puzzle: 15p\nSchulte Grid: grid\nPong: pong\nAtoZ: atoz\nUltimate Tic-tac-toe: uttt\nCubefield: cube\n2048: 2048\nJust get ten: ten\nTapping speed test: tap",
"Type the following codes in the search bar of this dictionary for some fun minigames!\n\n15-Puzzle: 15p\nSchulte Grid: grid\nPong: pong\nAtoZ: atoz\nUltimate Tic-tac-toe: uttt\nCubefield: cube\n2048: 2048\nJust get ten: ten\nTapping speed test: tap\nDon't touch white: dtw",
},
--English

View File

@@ -131,7 +131,7 @@ return{
{"Tetris Effect",
"tec tetriseffectconnect",
"game",
"一个win/ps4平台方块特效方块游戏只有单机模式手感不算太好想看特效的可以一试只是去玩方块的不是很建议\n有一个拓展版本Tetris Effect: Connect增加了联网对战包含普通对战zone对战经典对战和boss战四个模式",
"一个win/ps4平台方块特效方块游戏只有单机模式手感不算太好想看特效的可以一试只是去玩方块的不是很建议\n有一个拓展版本Tetris Effect: Connected增加了联网对战包含普通对战zone对战经典对战和boss战四个模式",
},
{"Techmino",
"techmino tieke",
@@ -770,7 +770,7 @@ return{
{"小游戏",
"minigame xiaoyouxi",
"other",
"输入以下词语,小游戏免费玩!\n\n15-Puzzle: 15p\nSchulte Grid: grid\nPong: pong\nAtoZ: atoz\nUltimate Tic-tac-toe: uttt\nCubefield: cube\n2048: 2048\nJust get ten: ten\nTapping speed test: tap",
"输入以下词语,小游戏免费玩!\n\n15-Puzzle: 15p\nSchulte Grid: grid\nPong: pong\nAtoZ: atoz\nUltimate Tic-tac-toe: uttt\nCubefield: cube\n2048: 2048\nJust get ten: ten\nTapping speed test: tap\nDon't touch white: dtw",
},
--英文

View File

@@ -646,6 +646,10 @@ return{
next="Next",
blind="Blind",
},
mg_dtw={
reset="Reset",
mode="Mode",
},
savedata={
exportUnlock="Export progress",
exportData="Export statistics",

View File

@@ -560,6 +560,10 @@ return{
next="Prévisualisations",
blind="Aveugler",
},
mg_dtw={
reset="Réinitialiser",
-- mode="Mode",
},
help={
manual="Manuel",
dict="Little Z",

View File

@@ -645,6 +645,10 @@ return{
next="Próxima",
blind="Cego",
},
mg_dtw={
reset="Resetar",
-- mode="Mode",
},
savedata={
exportUnlock="Exportar progresso",
exportData="Exportar estatística",

View File

@@ -562,6 +562,10 @@ return{
next="Siguiente",
blind="A ciegas",
},
mg_dtw={
reset="Reiniciar",
-- mode="Mode",
},
savedata={
-- exportUnlock="Export Unlock",
-- exportData="Export Data",

View File

@@ -489,6 +489,10 @@ return{
next="",
blind="???",
},
mg_dtw={
reset="R",
mode="?",
},
},
getTip=function()
local L="!@#$%^&*()-=_+[]{}\\|;:\'\",<.>/?"

View File

@@ -648,6 +648,10 @@ return{
next="预览",
blind="盲打",
},
mg_dtw={
reset="重置",
mode="模式",
},
savedata={
exportUnlock="导出地图进度",
exportData="导出统计数据",

View File

@@ -47,6 +47,7 @@ local eggInput={
["2048"]=goScene"mg_2048",
ten=goScene"mg_ten",
tap=goScene"mg_tap",
dtw=goScene"mg_dtw",
flag=function()
BG.setDefault("none")
BGM.setDefault(false)

201
parts/scenes/mg_dtw.lua Normal file
View File

@@ -0,0 +1,201 @@
local gc=love.graphics
local int,rnd=math.floor,math.random
local format=string.format
local ins,rem=table.insert,table.remove
local targets={
[40]=true,
[100]=true,
[200]=true,
[400]=true,
[620]=true,
[1000]=true,
[2600]=true,
[5000]=true,
[10000]=true,
[26000]=true,
}
local state,progress
local startTime,time
local modeName={
"Normal",
"Split",
"Mess",
"Short",
"Stairs",
}
local mode=1
local score
local pos,height
local diePos
local function newTile()
local r
if mode==1 then
r=rnd(4)
elseif mode==2 then
r=pos[#pos]<=2 and rnd(3,4)or rnd(2)
elseif mode==3 then
r=rnd(3)
if r>=pos[#pos]then r=r+1 end
elseif mode==4 then
if pos[#pos]==pos[#pos-1]then
r=rnd(3)
if r>=pos[#pos]then r=r+1 end
else
r=rnd(4)
end
elseif mode==5 then
r=pos[#pos]+(rnd(2)*2-3)
if r<1 then
r=r+2
elseif r>4 then
r=r-2
end
end
ins(pos,r)
end
local function reset()
progress={}
state,time=0,0
score=0
pos={rnd(4)}for _=1,5 do newTile()end
height=0
diePos=false
end
local scene={}
function scene.sceneInit()
BG.set("grey")
BGM.play("way")
mode=1
reset()
end
local function touch(n)
if state==0 then
state=1
startTime=TIME()
end
if n==pos[1]then
rem(pos,1)
newTile()
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
height=height+120
SFX.play("lock")
else
time=TIME()-startTime
state=2
diePos=n
SFX.play("fail")
end
end
function scene.keyDown(key)
if key=="r"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)
elseif key=="q"and state==0 then
mode=mode%#modeName+1
reset()
end
end
end
function scene.mouseDown(x)
scene.touchDown(x)
end
function scene.touchDown(x)
if state==2 then return end
x=int((x-300)/170+1)
if x>=1 and x<=4 then
touch(x)
end
end
function scene.update()
if state==1 then
time=TIME()-startTime
end
height=height*.6
end
function scene.draw()
--Draw mode
gc.setColor(1,1,1)
setFont(50)
mStr(modeName[mode],155,320)
--Draw time
setFont(40)
gc.print(format("%.3f",time),1030,70)
--Progress time list
setFont(25)
gc.setColor(.6,.6,.6)
for i=1,#progress do
gc.print(progress[i],1030,120+25*i)
end
--Draw tiles
gc.setColor(1,1,1)
gc.rectangle("fill",300,0,680,720)
gc.setColor(0,0,0)
for i=1,#pos do
gc.rectangle("fill",130+170*pos[i]+8,720-i*120-height+8,170-16,120-16)
end
--Draw track line
gc.setLineWidth(4)
for x=1,5 do
x=130+170*x
gc.line(x,0,x,720)
end
for y=0,6 do
y=720-120*y-height
gc.line(300,y,980,y)
end
--Draw red tile
if diePos then
gc.setColor(1,.2,.2)
gc.rectangle("fill",130+170*diePos+6,600-height+6,170-12,120-12)
end
--Draw score
setFont(100)
gc.push("transform")
gc.translate(640,26)
gc.scale(1.6)
gc.setColor(.5,.5,.5,.6)
mStr(score,0,0)
gc.pop()
end
scene.widgetList={
WIDGET.newButton{name="reset", x=155,y=100,w=180,h=100,color="lGreen",font=40,code=pressKey"r"},
WIDGET.newButton{name="mode", x=155,y=220,w=180,h=100,font=40,code=pressKey"q",hide=function()return state~=0 end},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=backScene},
}
return scene