On OpenCard
If Game_on is not 1 then
  play doriru
    put 3 into ntx
   naratoranimex
wait 2 seconds
  play bokuwo
    put 5 into ntx
   naratoranimex
end if

repeat with i = 1 to 16
put random(4) into digit_a
   
        
if digit_a = 1 or digit_a = 2 or digit_a = 3 then
put random(9) into a_number
put random(9) into b_number
put a_number * 10 + b_number into Item i of fldarray
putInt Item i of fldarray into fld %i%
else
put random(9) into a_number
put a_number into Item i of fldarray
putInt Item i of fldarray into fld %i%

end if
put 0 into Item i of checkarray
end repeat


put 25 into Item 1 of btnarray
put 24 into Item 2 of btnarray
put 15 into Item 3 of btnarray
put 18 into Item 4 of btnarray
put 12 into Item 5 of btnarray
put 26 into Item 6 of btnarray
put 19 into Item 7 of btnarray
put 14 into Item 8 of btnarray
put 16 into Item 9 of btnarray
put 20 into Item 10 of btnarray
put 13 into Item 11 of btnarray
put 23 into Item 12 of btnarray
put 21 into Item 13 of btnarray
put 17 into Item 14 of btnarray
put 22 into Item 15 of btnarray
put 27 into Item 16 of btnarray


put 29 into Item 1 of hotaruarray
put 33 into Item 2 of hotaruarray
put 38 into Item 3 of hotaruarray
put 39 into Item 4 of hotaruarray
put 30 into Item 5 of hotaruarray
put 34 into Item 6 of hotaruarray
put 40 into Item 7 of hotaruarray
put 42 into Item 8 of hotaruarray
put 31 into Item 9 of hotaruarray
put 35 into Item 10 of hotaruarray
put 43 into Item 11 of hotaruarray
put 41 into Item 12 of hotaruarray
put 32 into Item 13 of hotaruarray
put 36 into Item 14 of hotaruarray
put 37 into Item 15 of hotaruarray
put 44 into Item 16 of hotaruarray




End OpenCard







On Reset34

repeat with i = 1 to 16
put random(4) into digit_a
   
        
if digit_a = 1 or digit_a = 2 or digit_a = 3 then
put random(9) into a_number
put random(9) into b_number
put a_number * 10 + b_number into Item i of fldarray
putInt Item i of fldarray into fld %i%
else
put random(9) into a_number
put a_number into Item i of fldarray
putInt Item i of fldarray into fld %i%

end if
put 0 into Item i of checkarray
end repeat



put 25 into Item 1 of btnarray
put 24 into Item 2 of btnarray
put 15 into Item 3 of btnarray
put 18 into Item 4 of btnarray
put 12 into Item 5 of btnarray
put 26 into Item 6 of btnarray
put 19 into Item 7 of btnarray
put 14 into Item 8 of btnarray
put 16 into Item 9 of btnarray
put 20 into Item 10 of btnarray
put 13 into Item 11 of btnarray
put 23 into Item 12 of btnarray
put 21 into Item 13 of btnarray
put 17 into Item 14 of btnarray
put 22 into Item 15 of btnarray
put 27 into Item 16 of btnarray


put 29 into Item 1 of hotaruarray
put 33 into Item 2 of hotaruarray
put 38 into Item 3 of hotaruarray
put 39 into Item 4 of hotaruarray
put 30 into Item 5 of hotaruarray
put 34 into Item 6 of hotaruarray
put 40 into Item 7 of hotaruarray
put 42 into Item 8 of hotaruarray
put 31 into Item 9 of hotaruarray
put 35 into Item 10 of hotaruarray
put 43 into Item 11 of hotaruarray
put 41 into Item 12 of hotaruarray
put 32 into Item 13 of hotaruarray
put 36 into Item 14 of hotaruarray
put 37 into Item 15 of hotaruarray
put 44 into Item 16 of hotaruarray


lock screen
repeat with Original = 1 to 16
put Item Original of btnarray into oo
put Item Original of hotaruarray into ooo
show btn %oo%
show btn %ooo%
hide fld %Original%
end repeat

unlock screen




End Reset34















On hotaruleft
put random(10) into h
put LocH of btn %hotaru_btn_no% into x0
put LocV of btn %hotaru_btn_no% into y0
put y0 - h * 10 into y1
put x0 /20 into n
put h * 10 /n into nn
set bitmap of btn  %hotaru_btn_no% to hotarflu
repeat with i = 1 to n
 set loc of btn  %hotaru_btn_no% to x0 - (i-1) * 20, y0 - nn *(i-1) + h 
end repeat
hide btn  %hotaru_btn_no%
set bitmap of btn %hotaru_btn_no% to hotarul
End hotaruleft


On hotaruright
put random(10) into h
put LocH of btn %hotaru_btn_no% into x0
put LocV of btn %hotaru_btn_no% into y0
put y0 - h * 10 into y1
put (640-x0) /20 into n
put h * 10 /n into nn
set bitmap of btn  %hotaru_btn_no% to hotarfur
repeat with i = 1 to n
 set loc of btn  %hotaru_btn_no% to x0  + (i-1) * 20, y0 - nn *(i-1) + h 
end repeat
hide btn  %hotaru_btn_no%
set bitmap of btn %hotaru_btn_no% to hotarur

End hotaruright



On GetNumber
put random(16) into r1
put 0 into found
repeat with j = r1 to 16
 if Item j of checkarray = 0 then
     put 1 into found
     exit repeat
 end if
end repeat
if found = 1 then
  exit GetNumber
end if
if found = 0 then
repeat with j = 1 to r1-1
 if Item j of checkarray = 0 then
     put 1 into found
     exit repeat
 end if
end repeat
end if
End GetNumber

On GameStart
put 0 into rightanswer
put 0 into mistake
putInt 0 into fld right_ans
putInt 0 into fld TotalQ
Repeat while 1=1
 GetNumber
 if found is not 0 then
      put j into jjj
      put Item jjj of Hotaruarray into hh1
            put hh1 into hotaru_btn_no
       play chirps
       if hh1 = 38 or hh1 = 30 or hh1 = 34 or hh1 = 42 or hh1 = 31 or hh1=35 then
          HotaruRight
       else
          HotaruLeft
       end if
       put x0 into h1x
       put y0 into h1y
       Lock screen
       put Item jjj of btnarray into bbb
        hide btn %bbb%
        put random(3) into mmm
       if mmm = 3 and Item jjj of fldarray >9 and Item jjj of fldarray < 100 then
          put  Item jjj of fldarray * 10 into Item jjj of fldarray
          putInt Item jjj of fldarray into fld %jjj%
          put 4 into mmm
       else 
        put 0 into mmm
       end if
       show fld %jjj%
        set loc of btn hidebtn1 to LocH of btn %bbb%, LocV of btn %bbb%
       show btn hidebtn1
       unlock screen
-------------------
     repeat while 1 = 1
       GetNumber
       if j is not jjj then
          exit repeat
       end if
     end repeat
        put j into kkk
         
      put Item kkk of Hotaruarray into hh2
            put hh2 into hotaru_btn_no
       if hh2 = 38 or hh2 = 30 or hh2 = 34 or hh2 = 42 or hh2 = 31 or hh2=35 then
          HotaruRight
       else
          HotaruLeft
       end if
         put x0 into h2x
       put y0 into h2y
     Lock screen
       put Item kkk of btnarray into ccc
        hide btn %ccc%
        if mmm = 4 then
            if Item kkk of fldarray > 9 and Item kkk of fldarray < 100 then
               put Item kkk of fldarray * 10 into Item kkk of fldarray
            else
               put Item kkk of fldarray * 100 into Item kkk of fldarray
            end if
           putInt Item kkk of fldarray into fld %kkk%
           put 0 into mmm
        end if

        show fld %kkk%
        set loc of btn hidebtn2 to LocH of btn %ccc%, LocV of btn %ccc%
       show btn hidebtn2
      unlock screen

      if random(2) = 1 or Item jjj of fldarray  = Item kkk of fldarray then
       put  Item jjj of fldarray  + Item kkk of fldarray into ans31
      QuizDlg4 "La suma de los dos nmeros es ____", ans31
      else
        if Item jjj of fldarray  > Item kkk of fldarray then
             put  Item jjj of fldarray  - Item kkk of fldarray into ans31
        else
             put  Item kkk of fldarray  - Item jjj of fldarray into ans31
        end if
      QuizDlg4 "La diferencia de  los dos nmeros es ____", ans31
     end if
      repeat while quiz_quit = 0
         wait 30 ticks
      end repeat
      put 0 into quiz_quit
  if math_answer is not 1 then
       if math_answer is  -1 then
          play  uhoh2
        lock screen
        show btn %ccc%
        hide fld %kkk%
        show btn %bbb%
        hide fld %jjj%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
       show btn %hh1%
       show btn %hh2%
       hide btn hidebtn1
       hide btn hidebtn2
        unlock screen
          exit repeat
        else
              play jawharp
          showwitch_surprised
            put mistake + 1 into mistake
            putInt rightanswer + mistake into fld TotalQ
      end if

        lock screen
        show btn %ccc%
        hide fld %kkk%
        show btn %bbb%
        hide fld %jjj%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
       show btn %hh1%
       show btn %hh2%
       hide btn hidebtn1
       hide btn hidebtn2
        unlock screen
       else
           play good
           show_frog_good
          put rightanswer + 1 into rightanswer
          putInt rightanswer + mistake into fld TotalQ
          putInt rightanswer into fld right_ans
     put 1 into Item jjj of checkarray
     put 1 into Item kkk of checkarray
    lock screen
     hide btn %hh1%
     hide btn %hh2%
     hide btn hidebtn1
     hide btn hidebtn2
     hide fld %jjj%
     hide fld %kkk%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
     unlock screen

      end if
  else
    repeat  5 times
    set direction of btn 2 to 1
--     wait 20 ticks
    set direction of btn 2 to 2
--     wait 20 ticks
    set direction of btn 2 to 3
--     wait 20 ticks
    set direction of btn 2 to 0
--     wait 20 ticks
    end repeat
            play AlRight
     
    set bitmap of btn 2 to frog2
     wait 60 ticks
    set bitmap of btn 2 to frog1
  wait 2 seconds
   play toomuch
--   RePlace by New Anime        show_frog_good
       exit repeat
   end if  




End Repeat 

reset34


     
    
 
End GameStart















On GameStart2
put 0 into rightanswer
put 0 into miskake
putInt 0 into fld right_ans
putInt 0 into fld TotalQ
Repeat 2 times
 GetNumber
 if found is not 0 then
      put j into jjj
      put Item jjj of Hotaruarray into hh1
            put hh1 into hotaru_btn_no
       play chirps
       if hh1 = 38 or hh1 = 30 or hh1 = 34 or hh1 = 42 or hh1 = 31 or hh1=35 then
          HotaruRight
       else
          HotaruLeft
       end if
       put x0 into h1x
       put y0 into h1y
       Lock screen
       put Item jjj of btnarray into bbb
        hide btn %bbb%
        put random(3) into mmm
       if mmm = 3 and Item jjj of fldarray >9 and Item jjj of fldarray < 100 then
          put  Item jjj of fldarray * 10 into Item jjj of fldarray
          putInt Item jjj of fldarray into fld %jjj%
          put 4 into mmm
       else 
        put 0 into mmm
       end if
       show fld %jjj%
        set loc of btn hidebtn1 to LocH of btn %bbb%, LocV of btn %bbb%
       show btn hidebtn1
       unlock screen
-------------------
     repeat while 1 = 1
       GetNumber
       if j is not jjj then
          exit repeat
       end if
     end repeat
        put j into kkk
         
      put Item kkk of Hotaruarray into hh2
            put hh2 into hotaru_btn_no
       if hh2 = 38 or hh2 = 30 or hh2 = 34 or hh2 = 42 or hh2 = 31 or hh2=35 then
          HotaruRight
       else
          HotaruLeft
       end if
         put x0 into h2x
       put y0 into h2y
     Lock screen
       put Item kkk of btnarray into ccc
        hide btn %ccc%
        if mmm = 4 then
            if Item kkk of fldarray > 9 and Item kkk of fldarray < 100 then
               put Item kkk of fldarray * 10 into Item kkk of fldarray
            else
               put Item kkk of fldarray * 100 into Item kkk of fldarray
            end if
           putInt Item kkk of fldarray into fld %kkk%
           put 0 into mmm
        end if

        show fld %kkk%
        set loc of btn hidebtn2 to LocH of btn %ccc%, LocV of btn %ccc%
       show btn hidebtn2
      unlock screen

      if random(2) = 1 or Item jjj of fldarray  = Item kkk of fldarray then
       put  Item jjj of fldarray  + Item kkk of fldarray into ans31
      QuizDlg4 "La suma de los dos nmeros es ____", ans31
      else
        if Item jjj of fldarray  > Item kkk of fldarray then
             put  Item jjj of fldarray  - Item kkk of fldarray into ans31
        else
             put  Item kkk of fldarray  - Item jjj of fldarray into ans31
        end if
      QuizDlg4 "La diferencia de los dos nmeros es ____", ans31
     end if
      repeat while quiz_quit = 0
         wait 30 ticks
      end repeat
      put 0 into quiz_quit
  if math_answer is not 1 then
       if math_answer is  -1 then
          play  uhoh2
        lock screen
        show btn %ccc%
        hide fld %kkk%
        show btn %bbb%
        hide fld %jjj%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
       show btn %hh1%
       show btn %hh2%
       hide btn hidebtn1
       hide btn hidebtn2
        unlock screen
          exit repeat
        else
              play jawharp
          showwitch_surprised
            put mistake + 1 into mistake
            putInt rightanswer + mistake into fld TotalQ
        lock screen
        show btn %ccc%
        hide fld %kkk%
        show btn %bbb%
        hide fld %jjj%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
       show btn %hh1%
       show btn %hh2%
       hide btn hidebtn1
       hide btn hidebtn2
        unlock screen

            exit repeat
      end if

        lock screen
        show btn %ccc%
        hide fld %kkk%
        show btn %bbb%
        hide fld %jjj%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
       show btn %hh1%
       show btn %hh2%
       hide btn hidebtn1
       hide btn hidebtn2
        unlock screen
       else
           play good
           show_frog_good
          put rightanswer + 1 into rightanswer
          putInt rightanswer + mistake into fld TotalQ
          putInt rightanswer into fld right_ans
     put 1 into Item jjj of checkarray
     put 1 into Item kkk of checkarray
    lock screen
     hide btn %hh1%
     hide btn %hh2%
     hide btn hidebtn1
     hide btn hidebtn2
     hide fld %jjj%
     hide fld %kkk%
        set loc of btn %hh1% to h1x, h1y
        set loc of btn %hh2% to h2x, h2y
     unlock screen

      end if
  else
    repeat  5 times
    set direction of btn 2 to 1
--     wait 20 ticks
    set direction of btn 2 to 2
--     wait 20 ticks
    set direction of btn 2 to 3
--     wait 20 ticks
    set direction of btn 2 to 0
--     wait 20 ticks
    end repeat
            play AlRight
     
    set bitmap of btn 2 to frog2
     wait 60 ticks
    set bitmap of btn 2 to frog1
  wait 2 seconds
   play toomuch
--   RePlace by New Anime        show_frog_good
       exit repeat
   end if  




End Repeat 

reset34


     
    
 
End GameStart2





