@helicase Here’s something I just threw together that might get you started. Just fill in your questions, the answers, and the values you want for each answer.
EDIT: Tap on an answer for the next question. The values you assign to an answer will be added to the score.
function setup()
questions()
answers()
values()
score=0
quest=1
end
function draw()
background(40, 40, 50)
fill(255)
if quest<=#qTab then
text(qTab[quest],200,700)
text(aTab[quest][1],200,500)
text(aTab[quest][2],200,400)
text(aTab[quest][3],200,300)
text(aTab[quest][4],200,200)
else
text("No more questions",WIDTH/2,HEIGHT/2)
end
text("SCORE "..score,WIDTH/2,HEIGHT-50)
end
function questions()
qTab={}
table.insert(qTab,"This is question 1")
table.insert(qTab,"This is question 2")
table.insert(qTab,"This is question 3")
table.insert(qTab,"This is question 4")
table.insert(qTab,"This is question 5")
end
function answers()
aTab={}
table.insert(aTab,{"ans1-1","ans1-2","ans1-3","ans1-4"})
table.insert(aTab,{"ans2-1","ans2-2","ans2-3","ans2-4"})
table.insert(aTab,{"ans3-1","ans3-2","ans3-3","ans3-4"})
table.insert(aTab,{"ans4-1","ans4-2","ans4-3","ans4-4"})
table.insert(aTab,{"ans5-1","ans5-2","ans5-3","ans5-4"})
end
function values()
sTab={}
table.insert(sTab,{4,3,2,1})
table.insert(sTab,{1,4,3,2})
table.insert(sTab,{3,2,1,4})
table.insert(sTab,{2,3,4,1})
table.insert(sTab,{2,4,3,1})
end
function touched(t)
if t.state==ENDED and quest<=#qTab then
if t.x>0 and t.x<WIDTH and t.y>450 and t.y<550 then
score=score+sTab[quest][1]
quest=quest+1
end
if t.x>0 and t.x<WIDTH and t.y>350 and t.y<450 then
score=score+sTab[quest][2]
quest=quest+1
end
if t.x>0 and t.x<WIDTH and t.y>250 and t.y<350 then
score=score+sTab[quest][3]
quest=quest+1
end
if t.x>0 and t.x<WIDTH and t.y>150 and t.y<250 then
score=score+sTab[quest][4]
quest=quest+1
end
end
end