--------------  card 48---------
On opencard 48
  put 48 into presentcard
  put 0 into init48
if game_on is not 1 then
play together
put 3 into ntx
naratoranimex
wait 2 seconds

 play bokuwo
   put 3 into ntx
   naratoranimex
end if

put random(9) into n
put random(9) into n2

putInt n into fld chita_interval
put n into ct
putInt n2 into fld horse_interval
put n2 into hs


putInt 0 into fld timeclock
put 0 into tc

put LocH of btn chita1 into XoriginalC
put LocV of btn chita1 into YoriginalC
put LocH of btn horse1 into XoriginalH
put LocV of btn horse1 into YoriginalH
end opencard


On chitaup
put ct + 1 into ct
if ct > 9 then
    put 1 into ct
end if
putInt ct into fld chita_interval

end chitaup



On horseup
put hs + 1 into hs
if hs > 9 then
    put 1 into hs
end if
putInt hs into fld horse_interval

end horseup




On FindKobaisu
put hs into h
put ct into c
if h >= C then
 repeat with i = 1 to 100
  if  (C*i) MOD h = 0 then
      if c*i >=h then
      put c*i into ans
      exit repeat
       end if

  end if
  end repeat
else
 repeat with i = 1 to 100
  if  (h * i) MOD c = 0 then
       if h*i >= c then
        put h*i into ans
        exit repeat
       end if
   end if
  end repeat
end if

End FindKobaisu
















On q_clock48
put 0  into clock48
Setclock48
if game_on is  1 and init48 = 0 then
--play imananji
--   put 3 into ntx
--   naratoranimex
 put 1 into init48
  end if
putString  "" into fld answer






put random(9) into n
put random(9) into n2

if n * n2 > 59 then
  put random(8) into n
  put random(7) into n2
end if


putInt n into fld chita_interval
put n into ct
putInt n2 into fld horse_interval
put n2 into hs


putInt 0 into fld timeclock
put 0 into tc

put LocH of btn chita1 into XoriginalC
put LocV of btn chita1 into YoriginalC
put LocH of btn horse1 into XoriginalH
put LocV of btn horse1 into YoriginalH







put 0 into quiz_quit
 FindKobaisu
  QuizDlg7 "The cheetah and horse will run together after __ min.", ans
 
      repeat while quiz_quit = 0
         wait 30 ticks
      end repeat


if math_answer is not -1 then
  putString "" into fld youranswerInt
  show fld youranswer
  show fld youranswerInt
  show fld fungo
  putInt  math_answer2 into fld youranswerInt
startclock

end if






  if math_answer is not 1 then
         if math_answer is  -1 then
          play  uhoh2
          else
              play jawharp
              showwitch_surprised
          end if
       else
           play good
           show_frog_good
      end if

  putString "" into fld youranswerInt
  hide fld youranswer
  hide fld youranswerInt
  hide fld fungo

End q_clock48
---------------------------



On startClock
FindKobaisu
put 0 into tc
putInt 0 into fld TimeClock
 play click_e
 wait 5 ticks
repeat with j = 1 to 81
put j into clock48
SetClock48
put j into tc
putInt j into fld TimeClock
if j MOD ans = 0 then
   bothrun
  putInt ans into fld answer
   exit repeat
else
  if j MOD h = 0 then
      horserun
  else
     if j MOD C = 0 then
      chitarun
     else
     wait 45 ticks
     end if
  end if
end if 

       play click_e
       wait 5 ticks

end repeat


End StartClock
















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

On SetClock48
	put clock48 mod 60 into fun
	set data of btn PinLong to fun * 6
	set data of btn PinShort to clock48 * 0.5
end SetClock48

On FunUp48
	repeat while mouse() is down
		put clock48 + 1 into clock48
		if clock48 >= 720 then
			put clock48 - 720 into clock48
		end if
		SetClock48
		wait 10 ticks
	end repeat
end FunUp48

On FunDown48
	repeat while mouse() is down
		put clock48 - 1 into clock48
		if clock48 < 0 then
			put clock48 + 720 into clock48
		end if
		SetClock48
		wait 10 ticks
	end repeat
end FunDown48

On JikanUp48
	repeat while mouse() is down
		put clock48 + 60 into clock48
		if clock48 >= 720 then
			put clock48 - 720 into clock48
		end if
		SetClock48
		wait 10 ticks
	end repeat
end JikanUp48

On JikanDown48
	repeat while mouse() is down
		put clock48 - 60 into clock48
		if clock48 < 0 then
			put clock48 + 720 into clock48
		end if
		SetClock48
		wait 10 ticks
	end repeat
end JikanDown48













On horserun
put 40 into unitdot
put 0 into unitcount
play hooves3

repeat with i = 1 to 3

put unitcount + 1 into unitcount

lock screen
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse2
unlock screen
 

put unitcount + 1 into unitcount

lock screen
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse3
unlock screen




put unitcount + 1 into unitcount

lock screen
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse4
unlock screen




put unitcount + 1 into unitcount

lock screen
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse5
unlock screen








put unitcount + 1 into unitcount

lock screen
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse6
unlock screen


put unitcount + 1 into unitcount

lock screen
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse7
unlock screen





put unitcount + 1 into unitcount

lock screen
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse8
unlock screen




put unitcount + 1 into unitcount

lock screen
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse1
unlock screen






end repeat

set loc of btn horse1 to XoriginalH,YoriginalH

End horserun


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

On chitarun
put 40 into unitdot
put 0 into unitcount
play catyowl

repeat with i = 1 to 3

put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita2
unlock screen
 

put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita3
unlock screen




put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita4
unlock screen




put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita5
unlock screen








put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita6
unlock screen


put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita7
unlock screen





put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita8
unlock screen




put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita1
unlock screen






end repeat

set loc of btn chita1 to XoriginalC,YoriginalC

End chitarun







-------------- end card 48 ---------

On bothrun
put 40 into unitdot
put 0 into unitcount
play accent

repeat with i = 1 to 3

put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita2
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse2

unlock screen
 

put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita3
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse3
unlock screen




put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita4
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse4
unlock screen




put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita5
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse5
unlock screen








put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita6
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse6
unlock screen


put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita7
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse7
unlock screen





put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita8
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse8
unlock screen




put unitcount + 1 into unitcount

lock screen
set loc of btn chita1 to XoriginalC - unitcount * unitdot,YoriginalC
set bitmap of btn chita1 to chita1
set loc of btn horse1 to XoriginalH - unitcount * unitdot,YoriginalH
set bitmap of btn horse1 to horse1
unlock screen


put unitcount + 1 into unitcount




end repeat

set loc of btn chita1 to XoriginalC,YoriginalC
set loc of btn horse1 to XoriginalH,YoriginalH

End bothrun




-------------- end card 48 ---------
