まず、初期化の部分を考えます。
1 2 3 4 5 6 |
#define SIZE 250 // 数字の表示サイズ num = 3 // 合計出題数 koma = 50 // 1コマの表示時間 objsize 100, 25 randomize |
1 2 3 |
*init pos 10, 10 : button "開始", *game_main stop |
1 2 3 4 |
*game_main gosub *game_init gosub *game_draw stop |
1 2 3 4 5 6 7 8 |
*game_init answer = 0, 0 // 入力用, 正解用(合計) dim question, num foreach question question.cnt = rnd(9) + 1 // 1〜9のいずれをセット answer.1 += question.cnt loop return |
1 2 3 4 5 6 7 8 9 10 11 |
*game_draw clrobj font msmincho, SIZE foreach question color 255, 255, 255 : boxf : color , 150 wait 10 pos (ginfo_winx - SIZE / 2) / 2, (ginfo_winy - SIZE) / 2 // 画面中央 mes question.cnt wait koma loop return |
1 2 3 4 5 |
*game_main gosub *game_init gosub *game_draw gosub *game_answer stop |
1 2 3 4 5 6 7 |
*game_answer color 255, 255, 255 : boxf : color font msmincho, 15 pos 10, 10 : mes "合計値を入力してください。" pos 10, 40 : input answer, 100, 20 pos 10, 70 : button gosub "解答", *game_judge return |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
*game_judge clrobj color 255, 255, 255 : boxf : color pos 10, 10 : mes "入力:" + answer.0 pos 10, 30 : mes "正解:" + answer.1 pos 10, 60 : button gosub "次へ", *game_main font msmincho, SIZE, 1 pos (ginfo_winx - SIZE) / 2, (ginfo_winy - SIZE) / 2 // 画面中央 if answer.0 ! answer.1 { color 255 mes "×" } else { color , , 255 mes "○" } return |