fillellipse(ballx, bally,15,15);
Sleep(3);
}
//木板的运动
void drawboard()
{
setfillcolor(BLUE);
bar(boardx,boardy,boardx+80,boardy+20);
char n=getch();
switch(n)
{
case'a'://向左移动
case'A':
case'75':
//木板捕捉到小球
if(iscatch)
{
setfillcolor(RED);
fillellipse(ballx, bally,15,15);
}
boardx-=15;//木板移动幅度
break;
case'd'://向右移动
case'D':
case'77':
//木板捕捉到小球
if(iscatch)
{
setfillcolor(RED);
fillellipse(ballx, bally,15,15);
}
boardx-=15;//木板移动幅度
break;
}
setfillcolor(BLUE);
bar(boardx,boardy,boardx+80,boardy+20);
}
void play()
{
while (1)
{
drawzhuankuai();
if(kbhit())
{
drawboard();
}
drawBall();
if(bally>465)
break;
}
}
Sleep(3);
}
//木板的运动
void drawboard()
{
setfillcolor(BLUE);
bar(boardx,boardy,boardx+80,boardy+20);
char n=getch();
switch(n)
{
case'a'://向左移动
case'A':
case'75':
//木板捕捉到小球
if(iscatch)
{
setfillcolor(RED);
fillellipse(ballx, bally,15,15);
}
boardx-=15;//木板移动幅度
break;
case'd'://向右移动
case'D':
case'77':
//木板捕捉到小球
if(iscatch)
{
setfillcolor(RED);
fillellipse(ballx, bally,15,15);
}
boardx-=15;//木板移动幅度
break;
}
setfillcolor(BLUE);
bar(boardx,boardy,boardx+80,boardy+20);
}
void play()
{
while (1)
{
drawzhuankuai();
if(kbhit())
{
drawboard();
}
drawBall();
if(bally>465)
break;
}
}