c++ 控制台游戏打砖块
这个代码逻辑有点问题(出现了六个无法消除的幸运星),正在修改。
代码:
#include<iostream>
#include<conio.h>
#include<Windows.h>
using namespace std;
enum{
RightUp,
RightDown,
LeftUp,
LeftDown,
Over
};
void hui(int map[20][20]){
for (int i = 0; i < 20; i++){
for (int j = 0; j < 20; j++)
{
if (map[i][j] == 0){
cout << " ";
}
else if (map[i][j] == 4 || map[i][j] == 5){
cout << "■";
}
else if (map[i][j] == 3){
cout << "★";
}
else if (map[i][j] == 2){
cout << "〓";
}
else if (map[i][j] == 1)
{
cout << "●";
}
}
cout << endl;
}
}
void move(COORD & ball,int cx, int cy,int map[20][20],int & Gstate){
map[ball.X][ball.Y] = 0;
ball.X += cx;
ball.Y += cy;
if (ball.Y==19&&Gstate==RightDown){
ball.Y--;
ball.X