小游戏场景名统一mg_开头,方便查找

This commit is contained in:
MrZ626
2020-11-16 15:01:06 +08:00
parent 1f45b420cc
commit dda0f04b8d
14 changed files with 100 additions and 97 deletions

View File

@@ -1,4 +1,5 @@
local sin,cos=math.sin,math.cos
title={
{
53, 60,
@@ -119,6 +120,7 @@ for _,C in next,title do
C[i]=C[i]*.1626
end
end
--[[
title2={}
for i=1,#title do title2[i]=title[i]end
@@ -147,6 +149,7 @@ title2[5]={
2779, 1280,
}
]]
title_fan={}
for i=1,8 do
local L={}
@@ -232,7 +235,7 @@ drawableText={
noScore=T(45),highScore=T(30),
}
do
do--spinCenters
local N1,N2,N3,N4={0,1},{1,0},{1,1},{.5,.5}
local I1,I2,I3,I4={-.5,1.5},{1.5,-.5},{.5,1.5},{1.5,.5}
local V4={1.5,1.5}

View File

@@ -7,7 +7,7 @@ local int=math.floor
local rnd=math.random
local format=string.format
function sceneInit.p15()
function sceneInit.mg_15p()
BG.set("rainbow")
BGM.play("push")
sceneTemp={
@@ -130,7 +130,7 @@ local function tapBoard(x,y,key)
end
end
end
function keyDown.p15(key)
function keyDown.mg_15p(key)
local S=sceneTemp
local b=S.board
if key=="up"then
@@ -173,24 +173,24 @@ function keyDown.p15(key)
SCN.back()
end
end
function mouseDown.p15(x,y)
function mouseDown.mg_15p(x,y)
tapBoard(x,y)
end
function mouseMove.p15(x,y)
function mouseMove.mg_15p(x,y)
if sceneTemp.slide then
tapBoard(x,y)
end
end
function touchDown.p15(_,x,y)
function touchDown.mg_15p(_,x,y)
tapBoard(x,y)
end
function touchMove.p15(_,x,y)
function touchMove.mg_15p(_,x,y)
if sceneTemp.slide then
tapBoard(x,y)
end
end
function Tmr.p15()
function Tmr.mg_15p()
local S=sceneTemp
if S.state==1 then
S.time=Timer()-S.startTime
@@ -261,7 +261,7 @@ local backColor={
COLOR.black,COLOR.black,COLOR.black,COLOR.black,
},--Black
}
function Pnt.p15()
function Pnt.mg_15p()
local S=sceneTemp
setFont(40)
@@ -315,7 +315,7 @@ function Pnt.p15()
gc.rectangle("line",x*160+173,y*160-107,134,134,50)
end
WIDGET.init("p15",{
WIDGET.init("mg_15p",{
WIDGET.newButton({name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space")}),
WIDGET.newSlider({name="color", x=110,y=250,w=170,unit=4,show=false,font=30,disp=WIDGET.lnk_STPval("color"), code=function(v)if sceneTemp.state~=1 then sceneTemp.color=v end end,hide=WIDGET.lnk_STPeq("state",1)}),
WIDGET.newSwitch({name="blind", x=240,y=330,w=60, font=40,disp=WIDGET.lnk_STPval("blind"), code=WIDGET.lnk_pressKey("w"), hide=WIDGET.lnk_STPeq("state",1)}),

View File

@@ -19,7 +19,7 @@ local levels={
bpw="OHOOOOOOOOOAAAAEAAIAUJOOOOOOOOOOOAAEOAAUUAEEEEEEEEEAAAAEAEIEAJOOOOOOOOOOEEEEOAAAAAAA",
}
function sceneInit.AtoZ()
function sceneInit.mg_AtoZ()
BG.set("bg2")
BGM.play("way")
sceneTemp={
@@ -34,11 +34,11 @@ function sceneInit.AtoZ()
}
love.keyboard.setKeyRepeat(false)
end
function sceneBack.AtoZ()
function sceneBack.mg_AtoZ()
love.keyboard.setKeyRepeat(true)
end
function keyDown.AtoZ(key)
function keyDown.mg_AtoZ(key)
local S=sceneTemp
if #key==1 then
if S.state<2 and S.frameKeyCount<3 then
@@ -70,7 +70,7 @@ function keyDown.AtoZ(key)
end
end
function Tmr.AtoZ()
function Tmr.mg_AtoZ()
local S=sceneTemp
if S.state==1 then
S.frameKeyCount=0
@@ -78,7 +78,7 @@ function Tmr.AtoZ()
end
end
function Pnt.AtoZ()
function Pnt.mg_AtoZ()
local S=sceneTemp
setFont(40)
@@ -110,7 +110,7 @@ function Pnt.AtoZ()
gc.print(S.target,120,520)
end
WIDGET.init("AtoZ",{
WIDGET.init("mg_AtoZ",{
WIDGET.newSelector({name="level",x=640,y=640,w=200,list={"A_Z","Z_A","Tech1","Tech2","KeyTest1","KeyTest2","hello","zzz","zxzx","stair"},disp=WIDGET.lnk_STPval("level"),code=function(i)sceneTemp.level=i;sceneTemp.target=levels[i]end,hide=function()return sceneTemp.state>0 end}),
WIDGET.newButton({name="reset",x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space")}),
WIDGET.newButton({name="keyboard",x=160,y=210,w=180,h=100,code=function()love.keyboard.setTextInput(true,0,select(2,SCR.xOy:transformPoint(0,500)),1,1)end,hide=not MOBILE}),

View File

@@ -93,13 +93,13 @@ local function place(X,x)
round=1-round
end
function sceneInit.UTTT()
function sceneInit.mg_UTTT()
restart()
BGM.set("truth")
BG.set("bg2")
end
function Pnt.UTTT()
function Pnt.mg_UTTT()
gc.push("transform")
--origin pos:0,140; scale:4
gc.translate(280,0)
@@ -214,19 +214,19 @@ function Pnt.UTTT()
end
end
function touchDown.UTTT(_,x,y)
mouseMove.UTTT(x,y)
function touchDown.mg_UTTT(_,x,y)
mouseMove.mg_UTTT(x,y)
end
function touchMove.UTTT(_,x,y)
mouseMove.UTTT(x,y)
function touchMove.mg_UTTT(_,x,y)
mouseMove.mg_UTTT(x,y)
end
function touchUp.UTTT(_,x,y)
mouseDown.UTTT(x,y)
function touchUp.mg_UTTT(_,x,y)
mouseDown.mg_UTTT(x,y)
end
function mouseMove.UTTT(x,y)
function mouseMove.mg_UTTT(x,y)
x,y=int((x-280)/80),int(y/80)
curX,curx=int(x/3)+int(y/3)*3+1,x%3+y%3*3+1
if
@@ -241,12 +241,12 @@ function mouseMove.UTTT(x,y)
end
end
function mouseDown.UTTT(x,y)
mouseMove.UTTT(x,y)
function mouseDown.mg_UTTT(x,y)
mouseMove.mg_UTTT(x,y)
if curX then place(curX,curx)end
end
WIDGET.init("UTTT",{
WIDGET.init("mg_UTTT",{
WIDGET.newButton({name="reset",x=1140,y=540,w=170,h=80,font=40,color="lGreen",code=restart}),
WIDGET.newButton({name="back",x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK}),
})

View File

@@ -5,7 +5,7 @@ local abs=math.abs
local max,min=math.max,math.min
local rnd=math.random
function sceneInit.pong()
function sceneInit.mg_pong()
BG.set("none")
BGM.play("way")
sceneTemp={
@@ -35,7 +35,7 @@ local function start()
sceneTemp.vx=rnd()>.5 and 6 or -6
sceneTemp.vy=rnd()*6-3
end
function keyDown.pong(key)
function keyDown.mg_pong(key)
local S=sceneTemp
if key=="space"then
if S.state==0 then
@@ -55,21 +55,21 @@ function keyDown.pong(key)
SCN.back()
end
end
function touchDown.pong(id,x,y)
touchMove.pong(id,x,y)
function touchDown.mg_pong(id,x,y)
touchMove.mg_pong(id,x,y)
if sceneTemp.state==0 then
start()
end
end
function touchMove.pong(_,x,y)
function touchMove.mg_pong(_,x,y)
sceneTemp[x<640 and"p1"or"p2"].y0=y
end
function mouseMove.pong(x,y)
function mouseMove.mg_pong(x,y)
sceneTemp[x<640 and"p1"or"p2"].y0=y
end
--Rect Area X:150~1130 Y:20~700
function Tmr.pong()
function Tmr.mg_pong()
local S=sceneTemp
--Update pads
@@ -146,7 +146,7 @@ function Tmr.pong()
S.x,S.y,S.vx,S.vy,S.ry=x,y,vx,vy,ry
end
function Pnt.pong()
function Pnt.mg_pong()
local S=sceneTemp
--Draw score
@@ -174,7 +174,7 @@ function Pnt.pong()
gc.rectangle("fill",1130,S.p2.y-50,20,100)
end
WIDGET.init("pong",{
WIDGET.init("mg_pong",{
WIDGET.newKey({name="reset",x=640,y=45,w=150,h=50,font=35,code=WIDGET.lnk_pressKey("r")}),
WIDGET.newKey({name="back",x=640,y=675,w=150,h=50,font=35,code=WIDGET.lnk_BACK}),
})

View File

@@ -10,7 +10,7 @@ local rnd=math.random
local format=string.format
local rem=table.remove
function sceneInit.schulte_G()
function sceneInit.mg_schulteG()
BGM.play("way")
sceneTemp={
board={},
@@ -73,13 +73,13 @@ local function tapBoard(x,y)
end
end
function mouseDown.schulte_G(x,y)
function mouseDown.mg_schulteG(x,y)
tapBoard(x,y)
end
function touchDown.schulte_G(_,x,y)
function touchDown.mg_schulteG(_,x,y)
tapBoard(x,y)
end
function keyDown.schulte_G(key)
function keyDown.mg_schulteG(key)
local S=sceneTemp
if key=="z"or key=="x"then
love.mousepressed(ms.getPosition())
@@ -112,14 +112,14 @@ function keyDown.schulte_G(key)
end
end
function Tmr.schulte_G()
function Tmr.mg_schulteG()
local S=sceneTemp
if S.state==1 then
S.time=Timer()-S.startTime+S.error
end
end
function Pnt.schulte_G()
function Pnt.mg_schulteG()
local S=sceneTemp
setFont(40)
@@ -171,7 +171,7 @@ function Pnt.schulte_G()
end
end
WIDGET.init("schulte_G",{
WIDGET.init("mg_schulteG",{
WIDGET.newButton({name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space"),hide=function()return sceneTemp.state==0 end}),
WIDGET.newSlider({name="rank", x=130,y=250,w=150,unit=3,show=false,font=40,disp=function()return sceneTemp.rank-3 end,code=function(v)sceneTemp.rank=v+3 end,hide=function()return sceneTemp.state>0 end}),
WIDGET.newSwitch({name="blind", x=240,y=330,w=60, font=40,disp=WIDGET.lnk_STPval("blind"), code=WIDGET.lnk_pressKey("q"),hide=WIDGET.lnk_STPeq("state",1)}),

View File

@@ -3,10 +3,10 @@ function sceneInit.minigame()
end
WIDGET.init("minigame",{
WIDGET.newButton({name="p15", x=240, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("p15")}),
WIDGET.newButton({name="schulte_G", x=640, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("schulte_G")}),
WIDGET.newButton({name="pong", x=1040, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("pong")}),
WIDGET.newButton({name="AtoZ", x=240, y=400,w=350,h=120,font=40,code=WIDGET.lnk_goScene("AtoZ")}),
WIDGET.newButton({name="UTTT", x=640, y=400,w=350,h=120,font=30,code=WIDGET.lnk_goScene("UTTT")}),
WIDGET.newButton({name="15p", x=240, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("mg_15p")}),
WIDGET.newButton({name="schulteG", x=640, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("mg_schulteG")}),
WIDGET.newButton({name="pong", x=1040, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("mg_pong")}),
WIDGET.newButton({name="AtoZ", x=240, y=400,w=350,h=120,font=40,code=WIDGET.lnk_goScene("mg_AtoZ")}),
WIDGET.newButton({name="UTTT", x=640, y=400,w=350,h=120,font=30,code=WIDGET.lnk_goScene("mg_UTTT")}),
WIDGET.newButton({name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK}),
})