//消砖块
#include <conio.h>
#include <graphics.h>
#include <stdio.h>
#include <stdlib.h>
#define high 480 //游戏画面尺寸
#define width 640
#define brick_num 10 //砖块的个数
//全局变量
int ball_x,ball_y; //小球的坐标
int ball_vx,ball_vy; //小球的速度
int bar_x,bar_y; //挡板的中心坐标
int bar_high,bar_width; //挡板的高度和宽度
int bar_left,bar_right,bar_top,bar_bottom; //挡板的上下左右的坐标
int radius; //小球的半径
int isbrickexist[brick_num]; //每个砖块是否存在,1为存在,0为没有了
int brick_high,brick_width; //每个砖块的高度和宽度
void startup() //数据的初始化
{
ball_x=width/2;
ball_y=high/2;
ball_vx=1;
ball_vy=1;
radius=20;
bar_high=high/20;
bar_width=width/5;
bar_x=width/2;
bar_y=high-bar_high/2;
bar_left=bar_x-bar_width/2;
bar_right=bar_x+bar_width/2;
bar_top=bar_y-bar_high/2;
bar_bottom=bar_y+bar_high/2;
brick_high=high/brick_num;
brick_width=width/brick_nu
消砖块
最新推荐文章于 2023-03-03 12:54:11 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)