今かんたんな格闘ゲームを作成中なんですが、デバックはうまくいっているのですが、実行中に
Aキーを押しても上へジャンプできないのですがどこが原因でしょうか。
#include "DxLib.h" int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){ int PlayerX,PlayerY; PlayerY=280; int kyara[6]; int img; char Key[256]; if( ChangeWindowMode(TRUE) != DX_CHANGESCREEN_OK || DxLib_Init() == -1 ) return -1; //ウィンドウ化と初期化処理 kyara[0]= LoadGraph("KIRYU.bmp"); kyara[1]= LoadGraph("KIRYU00.bmp"); kyara[2]= LoadGraph("KIRYU2.bmp"); kyara[3]= LoadGraph("KIRYU3.bmp"); kyara[4]= LoadGraph("KIRYU4.bmp"); kyara[5]= LoadGraph("KIRYU5.bmp"); PlayerX =320; int muki=5; int rakka; SetDrawScreen( DX_SCREEN_BACK ) ; //描画先を裏画面に設定 while(!ProcessMessage() && !ClearDrawScreen() && !GetHitKeyStateAll( Key ) && !Key[KEY_INPUT_ESCAPE]){ //↑メッセージ処理 ↑画面をクリア ↑キーボード入力状態取得 ↑ESCが押されると終了 rakka=-1; PlayerY-= rakka ;// 落下処理 if(PlayerY>280){PlayerY=280;rakka=0;} if(PlayerX<0){PlayerX=0;} if( Key[ KEY_INPUT_LEFT ] == 1 ) { //左ボタンが押されたら PlayerX=PlayerX-2; muki=4;} //左向きフラグを立てる if( Key[ KEY_INPUT_RIGHT] == 1 ){ //右ボタンが押されたら PlayerX=PlayerX+2; muki=5; } //右向きフラグを立てる if( Key[ KEY_INPUT_LEFT]== 1 && Key[ KEY_INPUT_Z] == 1 ){ muki=2;} if( Key[ KEY_INPUT_RIGHT]== 1 && Key[ KEY_INPUT_X] == 1 ){ muki=3;} if ((Key[KEY_INPUT_A]==1) && PlayerY == 280 ) { rakka=20; muki=1;} img=kyara[(muki)]; //画像をセット ClearDrawScreen(); DrawBox ( 0 , 0 , 640 , 480 ,GetColor( 255 , 255 , 255 ) , TRUE) ; // 四角形を描画 DrawGraph( PlayerX , PlayerY , img , TRUE ) ;//画像を描画 ScreenFlip(); } DxLib_End(); return 0; }