@Killer.Jo Since youāre messing with menuās, hereās a small menu program I have that lets you add/execute code in as many different screens as you want. Itās set up for 5 right now.
viewer.mode=FULLSCREEN
function setup()
ang=0
fx,fv=15,5
show=false
fOffset=0
sel={{"Func1",func1},
{"Func2",func2},
{"Func3",func3},
{"Func4",func4},
{"Func5",func5},
{"Back to editor",exit},}
end
function draw()
background(62)
fill(255)
if show then
showSelection()
else
fill(255)
text("Double tap screen for MENU",WIDTH/2,HEIGHT/2)
end
if fOffset>0 then
sel[fOffset][2]()
end
end
function showSelection()
rectMode(CENTER)
stroke(0, 237, 255, 255)
strokeWidth(3)
fill(255, 254, 0, 200)
rect(shx,shy,150,40)
fill(255, 0, 0, 255)
text("Select a Function",shx,shy)
for z=1,#sel do
fill(47, 207, 122, 109)
rect(shx,shy-z*40,150,40)
fill(255)
text(sel[z][1],shx,shy-z*40)
end
end
function touched(t)
if t.state==BEGAN then
if t.tapCount==2 then
fOffset=0
shx=WIDTH/2
shy=HEIGHT/1.4
show=true
return
end
if show and t.x>shx-75 and t.x<shx+75 then
for z=1,#sel do
if t.y>shy-z*40-15 and t.y<shy-z*40+15 then
fOffset=z
show=false
return
end
end
end
end
end
function exit()
viewer.close()
end
function func1()
background(236, 187, 67)
fill(255,0,0)
text("Double tap screen for MENU",WIDTH/2,HEIGHT-100)
text("Executing func1",WIDTH/2,HEIGHT-130)
fill(53, 0, 255)
ellipse(fx,HEIGHT/2,100)
fx=fx+fv
if fx>=WIDTH-10 or fx<=10 then
fv=fv*-1
end
end
function func2()
background(58, 255, 0)
fill(255,0,0)
text("Double tap screen for MENU",WIDTH/2,HEIGHT-100)
text("Executing func2",WIDTH/2,HEIGHT-130)
translate(WIDTH/2,HEIGHT/2)
ang=ang+1
rotate(ang)
rect(0,0,150,250)
end
function func3()
background(58, 255, 0)
fill(255,0,0)
text("Double tap screen for MENU",WIDTH/2,HEIGHT-100)
text("Executing func3",WIDTH/2,HEIGHT-130)
translate(WIDTH/2,HEIGHT/2)
ang=ang+1
rotate(ang)
sprite(asset.builtin.Tyrian_Remastered.Evil_Head,0,0,350,350)
end
function func4()
background(0, 255, 236)
fill(255,0,0)
text("Double tap screen for MENU",WIDTH/2,HEIGHT-100)
text("Executing func2",WIDTH/2,HEIGHT-130)
text("Add code to do something",WIDTH/2,HEIGHT/2)
end
function func5()
background(245, 0, 255)
fill(255)
text("Double tap screen for MENU",WIDTH/2,HEIGHT-100)
text("Executing func5",WIDTH/2,HEIGHT-130)
text("Add code to do something",WIDTH/2,HEIGHT/2)
end