/*ブロック崩しの作り方 中間ソース2*/

/*目次へ戻る*/ #include "DxLib.h" int my_get_key(void); int key[256]; int gamecount; int Color_White = GetColor(255,255,255); int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int){ ChangeWindowMode(TRUE); DxLib_Init(); SetDrawScreen(DX_SCREEN_BACK); int ball_x = 0; int ball_y = 0; int x_direction = 0; int y_direction = 0; while (ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && my_get_key()==0){ DrawCircle(ball_x,ball_y,10,Color_White,true); if(x_direction == 0){ ball_x = ball_x + 5; } else{ ball_x = ball_x - 5; } if(y_direction == 0){ ball_y = ball_y + 5; } else{ ball_y = ball_y - 5; } if(ball_x >= 640){ x_direction = 1; } if(ball_x <= 0){ x_direction = 0; } if(ball_y >= 480){ y_direction = 1; } if(ball_y <= 0){ y_direction = 0; } } DxLib_End(); return 0; } int my_get_key(){ char keys[256]; GetHitKeyStateAll(keys); for (int i = 0; i < 256; i++){ if (keys[i] != 0){ key[i]++; } else{ key[i] = 0; } } return 0; } /*ページの先頭へ*/ /*目次へ戻る*/ /*HOME*/