// タイピング練習ソフト // 出てきた文字が消えるまでに同じ文字キーを押してください(正しい指で) // とりあえす文字キーのみで、記号や数字はありません INIT { SetFont("MS 明朝",2) ; SelectScreen(0) ; Box(0,0,640,400*2,7,7) ; Print(32,240,0,8,16,1,"左クリックで開始/停止します") ; Print(32,260,0,8,16,1,"練習する指の選択は停止中に行なってください") ; Print(32,280,0,8,16,3,"ホームポジション(F、J)に左右の人差し指をおきます") ; Print(32,300,0,8,16,3,"手元を見ないで、画面の文字に注目!!!") ; // キーボード作図 px = 32 ; py = 32 ; x = px ; y = py ; loop(10){ Box(x,y,x+14,y+14,0,7) ; x = x + 16 ; } x = px + 8 ; y = py + 16 ; loop(9){ Box(x,y,x+14,y+14,0,7) ; x = x + 16 ; } x = px + 16 ; y = py + 32 ; loop(7){ Box(x,y,x+14,y+14,0,7) ; x = x + 16 ; } x = px + 16 * 3 + 8 ; y = py + 16 ; Box(x+1,y+1,x+13,y+13,0,7) ; x = px + 16 * 6 + 8 ; y = py + 16 ; Box(x+1,y+1,x+13,y+13,0,7) ; // 指の作図 x = px + 16 ; y = py + 48 ; n = 0 ; loop(4){ loop(10){ Circle(x,y,x+12,y+8,3,3) ; Circle(x+96,y,x+96+12,y+8,3,3) ; x = x + 1 ; y = y + 2 ; } n = n + 16 ; x = px + 16 + n ; y = py + 48 ; } // 効果音作成 x = 0 ; loop(256){ SetWaveBuf("beep_NG",x,sin(x*7)*40+60) ; SetWaveBuf("beep_OK",x,sin(x*14)*40+60) ; x = x + 2 ; } SetButtonCheck("ID_r_h",1) ; SetButtonCheck("ID_l_h",1) ; kx = 32 ; ky = 32 ; fpx = 0 ; // キーの位置 posy = 0 ; size = 1 ; col = 1 ; // 位置、サイズ、色 round = 0 ; r_type = 10 ; // 回転角、回転方向 get = 0 ; miss = 0 ; lost = 0 ; count = 0 ; pause_flag = 1 ; } PAINT { CopyBMP(0,0,0,640,400,1,108,0,640,400,0) ; // 裏画面の上を表画面へコピー } // 次の文字を選択する SetNextData { count = count + 1 ; if(round > 720){ round = 0 ; } size = 1 ; posy = 80 ; r_type = r_type * (-1) ; col = col + 1 ; if(col > 5){ col = 1 ; } // バッファから1文字選択 n = GetEditLength("IDD_buf") ; n = SEC % n ; AllSelectEdit("IDD_buf_1") ; ClearEdit("IDD_buf_1") ; GetEditText("IDD_buf",n,n,"IDD_buf_1") ; code1 = GetEditCode("IDD_buf_1",0) ; // 古いキー位置を消去 SelectScreen(0) ; Box(kx+2,ky+2,kx+12,ky+12,7,7) ; Circle(fpx*16+50,82,fpx*16+50+8,86,3,3) ; // 新しいキー位置を描画 px = 32 ; py = 32 ; if(code1 == 65){ kx = px+16*0+ 8 ; ky = py+16*1 ; fpx = 0 ; } // A if(code1 == 66){ kx = px+16*4+16 ; ky = py+16*2 ; fpx = 3 ; } // B if(code1 == 67){ kx = px+16*2+16 ; ky = py+16*2 ; fpx = 2 ; } // C if(code1 == 68){ kx = px+16*2+ 8 ; ky = py+16*1 ; fpx = 2 ; } // D if(code1 == 69){ kx = px+16*2+ 0 ; ky = py+16*0 ; fpx = 2 ; } // E if(code1 == 70){ kx = px+16*3+ 8 ; ky = py+16*1 ; fpx = 3 ; } // F if(code1 == 71){ kx = px+16*4+ 8 ; ky = py+16*1 ; fpx = 3 ; } // G if(code1 == 72){ kx = px+16*5+ 8 ; ky = py+16*1 ; fpx = 6 ; } // H if(code1 == 73){ kx = px+16*7+ 0 ; ky = py+16*0 ; fpx = 7 ; } // I if(code1 == 74){ kx = px+16*6+ 8 ; ky = py+16*1 ; fpx = 6 ; } // J if(code1 == 75){ kx = px+16*7+ 8 ; ky = py+16*1 ; fpx = 7 ; } // K if(code1 == 76){ kx = px+16*8+ 8 ; ky = py+16*1 ; fpx = 8 ; } // L if(code1 == 77){ kx = px+16*6+16 ; ky = py+16*2 ; fpx = 6 ; } // M if(code1 == 78){ kx = px+16*5+16 ; ky = py+16*2 ; fpx = 6 ; } // N if(code1 == 79){ kx = px+16*8+ 0 ; ky = py+16*0 ; fpx = 8 ; } // O if(code1 == 80){ kx = px+16*9+ 0 ; ky = py+16*0 ; fpx = 9 ; } // P if(code1 == 81){ kx = px+16*0+ 0 ; ky = py+16*0 ; fpx = 0 ; } // Q if(code1 == 82){ kx = px+16*3+ 0 ; ky = py+16*0 ; fpx = 3 ; } // R if(code1 == 83){ kx = px+16*1+ 8 ; ky = py+16*1 ; fpx = 1 ; } // S if(code1 == 84){ kx = px+16*4+ 0 ; ky = py+16*0 ; fpx = 3 ; } // T if(code1 == 85){ kx = px+16*6+ 0 ; ky = py+16*0 ; fpx = 6 ; } // U if(code1 == 86){ kx = px+16*3+16 ; ky = py+16*2 ; fpx = 3 ; } // V if(code1 == 87){ kx = px+16*1+ 0 ; ky = py+16*0 ; fpx = 1 ; } // W if(code1 == 88){ kx = px+16*1+16 ; ky = py+16*2 ; fpx = 1 ; } // X if(code1 == 89){ kx = px+16*5+ 0 ; ky = py+16*0 ; fpx = 6 ; } // Y if(code1 == 90){ kx = px+16*0+16 ; ky = py+16*2 ; fpx = 0 ; } // Z Box(kx+2,ky+2,kx+12,ky+12,5,5) ; Circle(fpx*16+50,82,fpx*16+50+8,86,5,5) ; } // 0.1 秒間隔の処理 TIMER { if(pause_flag == 1){ return ; } SetControlFocus("IDD_buf_k") ; SelectScreen(0) ; CopyBMP(0,0,0,640,400,0,0,400,640,400,0) ; // 裏画面の上を下へコピー posy = posy + 10 ; // 文字の位置 size = posy / 2 ; // 文字のサイズ round = round + r_type ; // 文字の回転角 Print(280,posy+400,round,size,size,col,"IDD_buf_1") ; if(posy >= 280){ lost = lost + 1 ; PlayWaveBuf("beep_NG",0) ; Print(280,posy+400,round,size,size,0,"IDD_buf_1") ; call("SetNextData") ; } CopyBMP(0,0,400,640,400,1,108,0,640,400,0) ; // 裏画面の下を表画面へコピー // キーが押された場合の処理 if(GetEditLength("IDD_buf_k") > 0){ code2 = GetEditCode("IDD_buf_k",0) ; flag = 0 ; if(code1 == code2 ){ flag = 1 ; } if(code1 == code2-32){ flag = 1 ; } // 大文字小文字を無視 if(flag == 1){ get = get + 1 ; PlayWaveBuf("beep_OK",0) ; call("SetNextData") ; } if(flag == 0){ miss = miss + 1 ; PlayWaveBuf("beep_NG",0) ; } AllSelectEdit("IDD_buf_k") ; ClearEdit("IDD_buf_k") ; } if(count > 50){ SelectScreen(1) ; Print(130,120,0,16,16,2,"GAME OVER") ; Print(160,140,0,16,16,1,"正解:") ; Print(160,160,0,16,16,2,"ミス:") ; Print(160,180,0,16,16,14,"無効:") ; PrintData(260,140,0,16,16,1,0,get) ; PrintData(260,160,0,16,16,2,0,miss) ; PrintData(260,180,0,16,16,14,0,lost) ; get = 0 ; miss = 0 ; lost = 0 ; count = 0 ; pause_flag = 1 ; return ; } } CREATE { SetTimer(100) ; // 0.1 秒タイマー SetWinStyle(2) ; SetWinSize(640,400) ; SetWinPos((SCR_X-WIN_X)/2,(SCR_Y-WIN_Y)/2,0) ; SetCaption("キーボードは両手で打とう!") ; SetWinColor(15) ; SubScreen(640,400*2) ; WaveBuf("beep_OK",512) ; WaveBuf("beep_NG",512) ; x = 8 ; y = 8 ; CreateControl(50," 右手 ","ID_control",x,y,90,94) ; x = x + 8 ; y = y + 16 ; w = 80 ; h = 18 ; CreateControl(20,"人差し指","ID_r_h",x,y,w,h) ; y = y + 18 ; CreateControl(20,"なか指","ID_r_n",x,y,w,h) ; y = y + 18 ; CreateControl(20,"くすり指","ID_r_k",x,y,w,h) ; y = y + 18 ; CreateControl(20,"子指","ID_r_s",x,y,w,h) ; y = y + 18 ; x = 8 ; y = y + 16 ; CreateControl(50," 左手 ","ID_control",x,y,90,94) ; x = x + 8 ; y = y + 16 ; w = 80 ; h = 18 ; CreateControl(20,"人差し指","ID_l_h",x,y,w,h) ; y = y + 18 ; CreateControl(20,"なか指","ID_l_n",x,y,w,h) ; y = y + 18 ; CreateControl(20,"くすり指","ID_l_k",x,y,w,h) ; y = y + 18 ; CreateControl(20,"子指","ID_l_s",x,y,w,h) ; y = y + 18 ; CreateControl(101,"JUMHYN","IDD_r_h",0,0,0,0) ; CreateControl(101,"KI","IDD_r_n",0,0,0,0) ; CreateControl(101,"LO","IDD_r_k",0,0,0,0) ; CreateControl(101,"P","IDD_r_s",0,0,0,0) ; CreateControl(101,"FRVTGB","IDD_l_h",0,0,0,0) ; CreateControl(101,"EDC","IDD_l_n",0,0,0,0) ; CreateControl(101,"WSX","IDD_l_k",0,0,0,0) ; CreateControl(101,"QAZ","IDD_l_s",0,0,0,0) ; CreateControl(101,"","IDD_buf",0,0,0,0) ; CreateControl(101,"","IDD_buf_1",0,0,0,0) ; CreateControl(101,"","IDD_buf_k",0,0,0,0) ; } LBUTTONDOWN { pause_flag = (pause_flag + 1) % 2 ; if(pause_flag == 1){ return ; } AllSelectEdit("IDD_buf") ; ClearEdit("IDD_buf") ; // バッファをクリア // チェック状態により対象文字をバッファにセット if(GetButtonCheck("ID_r_h")==1){ SetEditText("IDD_buf","IDD_r_h") ; } if(GetButtonCheck("ID_r_n")==1){ SetEditText("IDD_buf","IDD_r_n") ; } if(GetButtonCheck("ID_r_k")==1){ SetEditText("IDD_buf","IDD_r_k") ; } if(GetButtonCheck("ID_r_s")==1){ SetEditText("IDD_buf","IDD_r_s") ; } if(GetButtonCheck("ID_l_h")==1){ SetEditText("IDD_buf","IDD_l_h") ; } if(GetButtonCheck("ID_l_n")==1){ SetEditText("IDD_buf","IDD_l_n") ; } if(GetButtonCheck("ID_l_k")==1){ SetEditText("IDD_buf","IDD_l_k") ; } if(GetButtonCheck("ID_l_s")==1){ SetEditText("IDD_buf","IDD_l_s") ; } call("SetNextData") ; } // チェックボックスのクリックでチェック状態を反転させる ID_r_h{ SetButtonCheck("ID_r_h",(GetButtonCheck("ID_r_h")+1)%2) ; } ID_r_n{ SetButtonCheck("ID_r_n",(GetButtonCheck("ID_r_n")+1)%2) ; } ID_r_k{ SetButtonCheck("ID_r_k",(GetButtonCheck("ID_r_k")+1)%2) ; } ID_r_s{ SetButtonCheck("ID_r_s",(GetButtonCheck("ID_r_s")+1)%2) ; } ID_l_h{ SetButtonCheck("ID_l_h",(GetButtonCheck("ID_l_h")+1)%2) ; } ID_l_n{ SetButtonCheck("ID_l_n",(GetButtonCheck("ID_l_n")+1)%2) ; } ID_l_k{ SetButtonCheck("ID_l_k",(GetButtonCheck("ID_l_k")+1)%2) ; } ID_l_s{ SetButtonCheck("ID_l_s",(GetButtonCheck("ID_l_s")+1)%2) ; }