Little multiplication ap

For my 7 year old to practise his tables :slight_smile:

-- toma


-- This 

-- Generated by Cider
-- 
-- Add CiderControls as a dependency to enable controls
-- 
 
displayMode(FULLSCREEN)
supportedOrientations(LANDSCAPE_ANY)
showKeyboard()
-- 
function setup()
    bad=0
    good=0
    text1=""
    number=math.random(2,12)
    mult=math.random(1,12)
    fontSize(35)
    fill(0, 0, 0, 255)
     textBox1000 = TextBox('', 220, 400, 350, 490, textBox1000_Clicked)
    CCActiveTextBox=textBox1000
    textBox1000.fontSize=50
   -- button1000 = TextButton('Button', 280, 300, 410, 340, button1000_Clicked)
    button1000= TextButton('Answer', 660, 420, 790, 500, button1000_Clicked)
    button1000.fontSize=35
    label1000 = Label(mult..'X'..number.."=???"..text1, 150, 550, 640, 650, label1000_Clicked)
    label1000.fontSize = 50
end

function draw()
      background(23, 255, 0, 255)
    if ElapsedTime>360 then text("DONE",WIDTH/2, HEIGHT/2) hideKeyboard()
   else
     textBox1000:draw()
     button1000:draw()
    label1000.text=mult..'X'..number.."=?"
      label1000:draw()
    end
   text("good="..good, 300,HEIGHT-50)
    text("bad="..bad, 500, HEIGHT-50)
    text("time="..math.floor((360-ElapsedTime)/60).."m"..math.fmod(math.floor(360-ElapsedTime),60).."s", 801, HEIGHT-50)
    text("total="..good+bad,100,HEIGHT-50)
end

function touched(touch)
     textBox1000:touched(touch)
     button1000:touched(touch)
  
end

function textBox1000_Clicked()
    --TODO: add user code here
end

function keyboard(key)
    if CCActiveTextBox then
      CCActiveTextBox:acceptKey(key)
  end
end


function button1000_Clicked()
    text1=textBox1000.text
    if tonumber(text1)==number*mult then
        sound(SOUND_PICKUP, 37731)
        textBox1000.text=""
        good = good + 1
        mult=math.random(1,12)
        number=math.random(2,12)
    else sound(SOUND_EXPLODE, 34288)
        bad = bad + 1
        textBox1000.text=""
    end
    --TODO: add user code here
end

  


function keyboard(key)
    if CCActiveTextBox then
       CCActiveTextBox:acceptKey(key)
    end
end
 
```
 





  


~~

Nice idea! You have two copies of the keyboard function, btw.

Thanks, as for the two keyboards you probably guessed that I like the Cider code generator too much :slight_smile: