This is the rest of the ‘Main’ tab
-- This function gets called once every frame
function draw()
-- This sets a dark background color
pushStyle()
background(40, 40, 50)
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
fontSize(75)
text(FactorOne, 550 - (textSize(FactorOne)/2), 800)
text(FactorTwo, 550 - (textSize(FactorTwo)/2), 700)
text(NumberOne, 550 - (textSize(NumberOne)/2), 540)
textAlign()
fill(127, 127, 127, 255)
stroke(127, 127, 127, 255)
rect(300, 600, 250,10 )
drawButton9()
drawButton8()
drawButton7()
drawButton6()
drawButton5()
drawButton4()
drawButton3()
drawButton2()
drawButton1()
drawButton0()
drawButtonBackspace()
drawDecimalKey()
drawSubmitKey()
drawNextKey()
drawNegativeKey()
drawPositiveKey()
drawSquarekey()
drawcubekey()
if opperation == 1 then
text("+", 320, 640) elseif
opperation == 2 then
text("-", 320, 640) elseif
opperation == 3 then
text("x", 320, 640)
end
if isCorrect == 1 then
strokeWidth(7)
stroke(0, 255, 33, 255)
line(80, 600, 110, 550)
line(110, 550, 140, 650)
elseif
isCorrect == 2 then
strokeWidth(7)
stroke(255, 2, 0, 255)
line(80, 650, 140, 570)
line(140, 650, 80, 570)
end
popStyle()
text(Score, 200, 900)
saveLocalData("highscore", Score)
saveLocalData("scoreX", correctInRow)
end
function drawButton9()
button9.pos = vec2(275, 300)
button9:draw()
end
function drawButton8()
button8.pos = vec2(330, 300)
button8:draw()
end
function drawButton7()
button7.pos = vec2(385, 300)
button7:draw()
end
function drawButton6()
button6.pos = vec2(275, 245)
button6:draw()
end
function drawButton5()
button5.pos = vec2(330, 245)
button5:draw()
end
function drawButton4()
button4.pos = vec2(385, 245)
button4:draw()
end
function drawButton3()
button3.pos = vec2(275, 190)
button3:draw()
end
function drawButton2()
button2.pos = vec2(330, 190)
button2:draw()
end
function drawButton1()
button1.pos = vec2(385, 190)
button1:draw()
end
function drawButton0()
button0.pos = vec2(275, 135)
button0:draw()
end
function drawButtonBackspace()
buttonBackspace.pos = vec2(330, 135)
buttonBackspace:draw()
end
function drawDecimalKey()
decimalKey.pos = vec2(385, 135)
decimalKey:draw()
end
function drawSubmitKey()
SubmitKey.pos = vec2(550, 300)
SubmitKey:draw()
end
function drawNextKey()
NextKey.pos = vec2(550, 360)
NextKey:draw()
end
function drawNegativeKey()
negativeKey.pos = vec2(220, 135)
negativeKey:draw()
end
function drawPositiveKey()
positiveKey.pos = vec2(220, 190)
positiveKey:draw()
end
function drawSquarekey()
Squarekey.pos = vec2(150, 130)
Squarekey:draw()
end
function drawcubekey()
cubekey.pos = vec2(150, 80)
cubekey:draw()
end
function touched(touch)
button9:touched(touch)
button8:touched(touch)
button7:touched(touch)
button6:touched(touch)
button5:touched(touch)
button4:touched(touch)
button3:touched(touch)
button2:touched(touch)
button1:touched(touch)
button0:touched(touch)
buttonBackspace:touched(touch)
decimalKey:touched(touch)
SubmitKey:touched(touch)
NextKey:touched(touch)
negativeKey:touched(touch)
positiveKey:touched(touch)
Squarekey:touched(touch)
cubekey:touched(touch)
end