지금 공 튀기기 게임(?)같은 허접한 게임을 만들고 있는데 너무 어려워요ㅠㅠㅠㅠ

#include <stdio.h>
#include <windows.h>   // gotoxy함수를 위해 선언함
#include <conio.h>
#pragma warning(disable:4996)
void gotoxy(int x, int y)
{

 COORD Pos = { x, y };
 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos);

}

int main(void)
{

 int ch, i;
 int pos_x = 0, pos_y = 0;
 int pos_Ax = 1, pos_Ay = 1;
 int pos_a = 15, pos_b = 18;
 
 system("cls");
 // draw wall

 for (i = 0; i < 40; i++) { fputc('_', stdout); }
 gotoxy(0, 20);
 for (i = 0; i < 40; i++) { fputc('_', stdout); }

 for (i = 0; i < 20; i++) {
  gotoxy(0, i);
  fputc('|', stdout);
  gotoxy(40, i);
  fputc('|', stdout);
 }
 // draw ball
 gotoxy(pos_x, pos_y);
 fputc('O', stdout);       //현재위치에 0을 출력


 for (;;) {
  Sleep(100);
  // erase ball
  gotoxy(pos_x, pos_y);
  fputc(' ', stdout);
  pos_x += pos_Ax;
  pos_y += pos_Ay;
  if (pos_y == 0) {  // upper bound
   pos_y += 1;
   pos_Ay = +1;
  }
  if (pos_y == 20) { // lower bound
   pos_y -= 1;
   pos_Ay = -1;
  }
  if (pos_x == 0) { // left bound
   pos_x += 1;
   pos_Ax = 1;
  }
  if (pos_x == 40) { // left bound
   pos_x -= 1;
   pos_Ax = -1;
  }
  gotoxy(pos_x, pos_y);
  fputc('O', stdout);       //현재위치에 0을 출력
  if (kbhit())
  {
   gotoxy(pos_a, pos_b);
   printf("ㅡㅡㅡㅡㅡ");
   ch = _getch();
   gotoxy(pos_a, pos_b);
   if (ch == 'a') pos_a = pos_a - 1;
   if (ch == 'd') pos_a = pos_a + 1;
   if (pos_a > 30) pos_a = 30;
   if (pos_a < 2) pos_a = 2;
  }
  if (pos_x == 19) return 0;
 
 }

 return 0;

 
}





지금 여기까지 했는데 이제 공이 바에 맞으면 튕겨나가는 것만 남았는데 형님들 도와주세요ㅠㅠㅠㅠ