Here’s another starter game if someone wants to expand on it. The object is to see how fast you can tap the numbers from 1 to 100. The numbers are mixed up in a 10 by 10 square. The number you’re supposed to tap is shown at the top. If you tap the correct number it turns green, tap the wrong number and the tap number decremented by 1. Every 20 seconds the number you’re looking for is also decremented by 1 and the numbers are re-shuffled. Keep an eye on the number to tap. Once you tap all 100 numbers, your total time is shown. Double tap the screen to replay.
displayMode(FULLSCREEN)
supportedOrientations(PORTRAIT_ANY)
function setup()
limit=21 -- find limit
found=1
done=false
startTime=os.time()
totalTime=0
create(100)
end
function create(size)
tab={}
for z=1,size do
table.insert(tab,z)
end
for z=1,size do
local n=math.random(size+1-z)
table.insert(tab,tab[n])
table.remove(tab,n)
end
findTime=os.time()+limit
end
function draw()
background(40, 40, 50)
fontSize(30)
local count=0
for x=1,10 do
for y=1,10 do
count=count+1
fill(255)
if tab[count]<found then
fill(0,255,0)
end
rect(-65+x*75,y*75,75,75)
fill(255,0,0)
text(tab[count],-65+x*75+75/2,y*75+75/2)
end
end
fill(255)
if done then
text("Total time "..totalTime.." seconds.",WIDTH/2,HEIGHT-50)
text("Double tap to play again",WIDTH/2,HEIGHT-150)
else
text("Total seconds "..os.time()-startTime,200,HEIGHT-50)
local diff=findTime-os.time()
text("Seconds remaining "..diff,200,HEIGHT-150)
if diff<=0 then
sound(SOUND_BLIT, 45070)
create(100)
if found>1 then
found=found-1
end
end
fontSize(70)
text("Tap "..found,WIDTH-200,HEIGHT-100)
end
end
function touched(t)
if t.state==BEGAN then
if done then
if t.tapCount==2 then
restart()
end
return
end
x=math.floor((t.x+65)/75)
y=math.floor((t.y)/75)
if x>=1 and x<=10 and y>=1 and y<=10 then
if tab[(x-1)*10+y]==found then
found=found+1
elseif found>1 then
found=found-1
end
if found>100 then
totalTime=os.time()-startTime
done=true
end
end
end
end