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) /10.0 into Item i of fldarray
putFloat1 Item i of fldarray into fld %i%
else
put random(9) into a_number
put a_number * 100/10.0 + random(9)/10.0 into Item i of fldarray
putFloat1 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 32 into Item 2 of hotaruarray
put 37 into Item 3 of hotaruarray
put 38 into Item 4 of hotaruarray
put 63 into Item 5 of hotaruarray
put 33 into Item 6 of hotaruarray
put 39 into Item 7 of hotaruarray
put 41 into Item 8 of hotaruarray
put 30 into Item 9 of hotaruarray
put 34 into Item 10 of hotaruarray
put 42 into Item 11 of hotaruarray
put 40 into Item 12 of hotaruarray
put 31 into Item 13 of hotaruarray
put 35 into Item 14 of hotaruarray
put 36 into Item 15 of hotaruarray
put 43 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 )/10.0 into Item i of fldarray
putFloat1 Item i of fldarray into fld %i%
else
put random(9) into a_number
put a_number * 100 / 10.0  +  random(9) / 10.0 into Item i of fldarray
putFloat1 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 32 into Item 2 of hotaruarray
put 37 into Item 3 of hotaruarray
put 38 into Item 4 of hotaruarray
put 63 into Item 5 of hotaruarray
put 33 into Item 6 of hotaruarray
put 39 into Item 7 of hotaruarray
put 41 into Item 8 of hotaruarray
put 30 into Item 9 of hotaruarray
put 34 into Item 10 of hotaruarray
put 42 into Item 11 of hotaruarray
put 40 into Item 12 of hotaruarray
put 31 into Item 13 of hotaruarray
put 35 into Item 14 of hotaruarray
put 36 into Item 15 of hotaruarray
put 43 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 Item jjj of fldarray - Int(Item jjj of fldarray) > 0 then
          putFloat1 Item jjj of fldarray into fld %jjj%
        else
          putInt Item jjj of fldarray into fld %jjj%
        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 = 3 then
            if Item kkk of fldarray > 0 and Item kkk of fldarray < 10  then
               put Item kkk of fldarray * 100 + random(9)/10 into Item kkk of fldarray
            end if


        end if
        if mmm = 2 then
            if Item kkk of fldarray > 0 and Item kkk of fldarray < 10  then
               put Item kkk of fldarray * 10 + random(9)/10 into Item kkk of fldarray
            end if


        end if

        if Item kkk of fldarray - Int(Item kkk of fldarray) > 0 then

          putFloat1 Item kkk of fldarray into fld %kkk%
        else
           putInt Item kkk of fldarray into fld %kkk%

        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

      if ans31 - Int(ans31 ) > 0 then
      QuizDlg8 "Encuentra la suma de los dos nmeros!", ans31
      else
      QuizDlg4 "Encuentra la suma de los dos nmeros!", ans31
      end if

      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

      if ans31 - Int(ans31 ) > 0 then
      QuizDlg8 "Encuentra la diferencia entre los dos nmeros!", ans31
      else
      QuizDlg4 "Encuentra la diferencia entre los dos nmeros!", ans31

      end if



     end if
--PutFloat2 ans31 into fld rightanswer
      repeat while quiz_quit = 0
         wait 30 ticks
      end repeat
      put 0 into quiz_quit
--putint math_answer into fld 20
  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
     play AlRightL

    repeat  2 times

    set bitmap of btn 2 to orantmp2
    set bitmap of btn 2 to orantmp3
    set bitmap of btn 2 to orantmp4
    set bitmap of btn 2 to orantmp3

    end repeat
     
    set bitmap of btn 2 to orantmp1
  wait 1 seconds
    play chipmonk
  wait 2 seconds


   play toomuch
--   RePlace by New Anime        show_frog_good
       exit repeat
   end if  


--PutFloat2 ans31 into fld rightanswer



End Repeat 

reset34


     
    
 
End GameStart











On GameStart2
put 0 into rightanswer
put 0 into mistake
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 Item jjj of fldarray - Int(Item jjj of fldarray) > 0 then
          putFloat1 Item jjj of fldarray into fld %jjj%
        else
          putInt Item jjj of fldarray into fld %jjj%
        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 = 3 then
            if Item kkk of fldarray > 0 and Item kkk of fldarray < 10  then
               put Item kkk of fldarray * 100 + random(9)/10 into Item kkk of fldarray
            end if


        end if
        if mmm = 2 then
            if Item kkk of fldarray > 0 and Item kkk of fldarray < 10  then
               put Item kkk of fldarray * 10 + random(9)/10 into Item kkk of fldarray
            end if


        end if

        if Item kkk of fldarray - Int(Item kkk of fldarray) > 0 then

          putFloat1 Item kkk of fldarray into fld %kkk%
        else
           putInt Item kkk of fldarray into fld %kkk%

        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

      if ans31 - Int(ans31 ) > 0 then
      QuizDlg8 "Encuentra la suma de los dos nmeros!", ans31
      else
      QuizDlg4 "Encuentra la suma de los dos nmeros!", ans31
      end if

      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

      if ans31 - Int(ans31 ) > 0 then
      QuizDlg8 "Encuentra la diferencia entre los dos nmeros!", ans31
      else
      QuizDlg4 "Encuentra la diferencia entre los dos nmeros!", ans31

      end if



     end if
--PutFloat2 ans31 into fld rightanswer
      repeat while quiz_quit = 0
         wait 30 ticks
      end repeat
      put 0 into quiz_quit
--putint math_answer into fld 20
  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
           exit repeat
      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
     play AlRightL

    repeat  2 times

    set bitmap of btn 2 to orantmp2
    set bitmap of btn 2 to orantmp3
    set bitmap of btn 2 to orantmp4
    set bitmap of btn 2 to orantmp3

    end repeat
     
    set bitmap of btn 2 to orantmp1
 wait 1 seconds
    play chipmonk
  wait 2 seconds

   play toomuch
--   RePlace by New Anime        show_frog_good
       exit repeat
   end if  


--PutFloat2 ans31 into fld rightanswer



End Repeat 

reset34


     
    
 
End GameStart2




------------------------Animation



----------
On Idle

if MOUSEH() > LocH of btn hachi1ss -40 and  MOUSEH() < LocH of btn hachi1ss + 30 and  MOUSEV() < LocV of btn hachi1ss + 20 and  MOUSEV() > LocV of btn hachi1ss - 20 then

click at btn Hachi1ss
end if

if MOUSEH() > LocH of btn jagrtiny -40 and  MOUSEH() < LocH of btn jagrtiny + 30 and  MOUSEV() < LocV of btn jagrtiny + 20 and  MOUSEV() > LocV of btn jagrtiny - 20 then
click at btn jagrtiny
end if


if MOUSEH() > LocH of btn elp_i_ss -40 and  MOUSEH() < LocH of btn elp_i_ss + 30 and  MOUSEV() < LocV of btn elp_i_ss + 20 and  MOUSEV() > LocV of btn elp_i_ss - 20 then
click at btn elp_i_ss
end if


if MOUSEH() > LocH of btn squirl1 -40 and  MOUSEH() < LocH of btn squirl1 + 30 and  MOUSEV() < LocV of btn squirl1 + 20 and  MOUSEV() > LocV of btn squirl1 - 20 then
click at btn squirl1
end if


if MOUSEH() > LocH of btn mang -40 and  MOUSEH() < LocH of btn mang + 30 and  MOUSEV() < LocV of btn mang + 20 and  MOUSEV() > LocV of btn mang - 20 then
click at btn mang
end if


if MOUSEH() > LocH of btn lizrd1 -40 and  MOUSEH() < LocH of btn lizrd1 + 30 and  MOUSEV() < LocV of btn lizrd1 + 20 and  MOUSEV() > LocV of btn lizrd1 - 20 then
click at btn lizrd1
end if


if MOUSEH() > LocH of btn Kumo -40 and  MOUSEH() < LocH of btn Kumo + 30 and  MOUSEV() < LocV of btn Kumo + 20 and  MOUSEV() > LocV of btn Kumo - 20 then
click at btn Kumo
end if


if MOUSEH() > LocH of btn okapiss -40 and  MOUSEH() < LocH of btn okapiss + 30 and  MOUSEV() < LocV of btn okapiss + 20 and  MOUSEV() > LocV of btn okapiss - 20 then
click at btn okapiss
end if


if MOUSEH() > LocH of btn bat_fshs -40 and  MOUSEH() < LocH of btn bat_fshs + 30 and  MOUSEV() < LocV of btn bat_fshs + 20 and  MOUSEV() > LocV of btn bat_fshs - 20 then
click at btn bat_fshs
end if


if MOUSEH() > LocH of btn monk_ss -40 and  MOUSEH() < LocH of btn monk_ss + 30 and  MOUSEV() < LocV of btn monk_ss + 20 and  MOUSEV() > LocV of btn monk_ss - 20 then
click at btn monk_ss
end if


if MOUSEH() > LocH of btn ougiwasi -40 and  MOUSEH() < LocH of btn ougiwasi + 30 and  MOUSEV() < LocV of btn ougiwasi + 20 and  MOUSEV() > LocV of btn ougiwasi - 20 then
click at btn ougiwasi
end if

if MOUSEH() > LocH of btn gorilla -40 and  MOUSEH() < LocH of btn gorilla + 30 and  MOUSEV() < LocV of btn gorilla + 20 and  MOUSEV() > LocV of btn gorilla - 20 then
play gorilla
end if

if MOUSEH() > LocH of btn orange3 -40 and  MOUSEH() < LocH of btn orange3 + 30 and  MOUSEV() < LocV of btn orange3 + 20 and  MOUSEV() > LocV of btn orange3 - 20 then
click at btn orange3
end if

if MOUSEH() > LocH of btn tiger2s -40 and  MOUSEH() < LocH of btn tiger2s + 30 and  MOUSEV() < LocV of btn tiger2s + 20 and  MOUSEV() > LocV of btn tiger2s - 20 then
click at btn tiger2s
end if

if MOUSEH() > LocH of btn s_raf -40 and  MOUSEH() < LocH of btn s_raf + 30 and  MOUSEV() < LocV of btn s_raf + 20 and  MOUSEV() > LocV of btn s_raf - 20 then
click at btn s_raf
end if

if MOUSEH() > LocH of btn banana -40 and  MOUSEH() < LocH of btn banana + 30 and  MOUSEV() < LocV of btn banana + 20 and  MOUSEV() > LocV of btn banana - 20 then
click at btn banana
end if

end Idle


-------------

On HachissMOve

play morning
put LocH of btn hachi1ss into hx
put LocV of btn hachi1ss into hy


put random(2) into k

put random(200) into n

if k = 1 then
  put 10 into m
else
  put 13 into m
end if
repeat with i = 1 to m
lock screen

if i MOD 2 = 0 then
 set bitmap of btn  hachi1ss to hachi1ss
else
 set bitmap of btn  hachi1ss to hachi2ss
end if
if k = 1 then
set loc of btn hachi1ss to hx - 10*(i-1) - random(5), hy - 15 * (i -1) - random(7)
else
set loc of btn hachi1ss to hx - 10*(i-1) - random(5), hy + 15 * (i -1) - random(7)
end if


unlock screen
end repeat


put LocH of btn hachi1ss into x2
put LocV of btn hachi1ss into y2

put random(2) into j
repeat with i = 1 to 60
lock screen

if i MOD 2 = 0 then
 set bitmap of btn  hachi1ss to hachi1ss
else
 set bitmap of btn  hachi1ss to hachi2ss
end if
if j = 1 and k = 1 then
set loc of btn hachi1ss to x2 + 10*(i-1), y2 - n/60 * (i -1)
else
set loc of btn hachi1ss to x2 + 10*(i-1), y2 + n/60 * (i -1)
end if
unlock screen
end repeat
set loc of btn hachi1ss to hx, hy
End HachissMOve



On JagarMove
play growling

put random(4) into n

repeat with i = 1 to 2
 set bitmap of btn  jagrtiny to jagrtin2
wait 30 ticks
 set bitmap of btn  jagrtiny to jagrtiny
wait 30 ticks

end repeat
End JagarMove





On elephantMove
play elephant

put random(4) into n

repeat with i = 1 to n
 set bitmap of btn  elp_i_ss to elp_i_s2
wait 20 ticks
 set bitmap of btn  elp_i_ss to elp_i_ss
wait 20 ticks

end repeat
End elephantMove

On squirlMove
play squeakie

put random(4) into n

repeat with i = 1 to 2
 set bitmap of btn  squirl1 to squirl2
 set bitmap of btn  squirl1 to squirl3
 set bitmap of btn  squirl1 to squirl2
 set bitmap of btn  squirl1 to squirl1

end repeat

End squirlMove



On mangMove
play pyu_

put random(2) into n

repeat with i = 1 to n
 set bitmap of btn  mang to mang2
 set bitmap of btn  mang to mang

end repeat

End mangMove




On kumoMove
play gullbee
put random(5) into n

repeat with i = 1 to n
 set bitmap of btn  Kumo to Kumo2
wait 1 ticks
 set bitmap of btn  Kumo to Kumo
wait 1 ticks

end repeat

End kumoMove


On lizrdMove
play chirps2
put random(10) into n
put LocH of btn lizrd1 into xxx
put LocV of btn lizrd1 into yyy
put 0 into addn

repeat with i = 1 to 18
lock screen
if i MOD 3 = 0 then
set loc of btn lizrd1 to xxx + (i - 1) *40 + addn, yyy
 set bitmap of btn lizrd1 to lizrd1
end if
if i MOD 3 = 1 then
set loc of btn lizrd1 to xxx+ (i - 1) *40 + addn, yyy
 set bitmap of btn lizrd1 to lizrd2
end if
if i MOD 3 = 2 then
set loc of btn lizrd1 to xxx+ (i - 1) *40 + addn, yyy
 set bitmap of btn lizrd1 to lizrd3
end if
put addn + 20 into addn
unlock screen
end repeat
lock screen
set loc of btn lizrd1 to xxx , yyy
 set bitmap of btn lizrd1 to lizrd1
unlock screen
End lizrdMove
