新手C++ 坦克大战
本人新手写的比较杂乱,不喜勿喷,
1、首先,先用图片介绍下代码运行逻辑,
2、这是控制台的界面,展示一下各个功能的界面
开始界面
单人模式界面
双人模式界面
自定义地图
3、以下是代码展示
这是菜单类
#include "Menu.h"
#include <windows.h>
#include "Game.h"
//显示欢迎界面
void Menu::Show_Welcome()
{
Map::Colors(白色);
Map::WriteChar(2,8,"I - 2600 HI - 20000");
Map::Colors(紫色);
Map::WriteChar(5, 10, "▓▓▓▓▓ ▓ ▓▓▓▓▓ ▓▓▓▓▓ ▓ ▓▓▓▓▓");
Sleep(100);
Map::WriteChar(6, 10, "▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ");
Sleep(100);
Map::WriteChar(7, 10, "▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ");
Sleep(100);
Map::WriteChar(8, 10, "▓▓▓▓▓ ▓ ▓ ▓ ▓ ▓ ▓▓▓▓▓");
Sleep(100);
Map::WriteChar(9, 10, "▓ ▓ ▓▓▓▓▓▓ ▓ ▓ ▓ ▓ ");
Sleep(100);
Map::WriteChar(10, 10, "▓ ▓ ▓ ▓ ▓ ▓ ▓ ▓ ");
Sleep(100);
Map::WriteChar(11, 10, "▓▓▓▓▓ ▓ ▓ ▓ ▓ ▓▓▓▓ ▓▓▓▓▓");
Sleep(100);
Map::WriteChar(13, 14, " ▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓ ▓ ▓ ");
Sleep(100);
Map::WriteChar(14, 14, " ▓▓ ▓ ▓ ▓ ▓ ▓ ");
Sleep(100);
Map::WriteChar(15, 14, " ▓▓ ▓ ▓ ▓ ▓ ");
Sleep(100);
Map::WriteChar(16, 14, "▓ ▓ ▓ ▓▓▓ ");
Sleep(100);
Map::WriteChar(17, 14, " ▓▓ ▓ ▓ ▓ ");
Sleep(100);
Map::WriteChar(18, 14, " ▓▓ ▓ ▓ ▓ ▓ ");
Sleep(100);
Map::WriteChar(19, 14, " ▓▓▓▓ ▓▓▓▓▓ ▓ ▓ ");
Sleep(200);
}
//静态菜单信息
void Menu::Show_Menu()
{
Map::Colors(白色);
Map::WriteChar(38,22, "@ 1990 1980 NAMCO LTD.");
Map::WriteChar(39,24, "ALL RIGHTS RESERVED");
}
//自定义地图赋值及打印
int tool::Init_Map[41][41];
void tool::Init_Info()
{
int i,j;
for (i = 0; i < HIGHT; i++)
{
for (j = 0; j < WIDTH; j++)
{
Init_Map[41][41];
//初始化边框
if (Init_Map[i][j] == 边框)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN
| FOREGROUND_RED | FOREGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE);
Map::WriteChar(i, j, "■");
}
if (Init_Map[i][j] == 黄土墙)//被击中变成红土墙
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_RED);
Map::WriteChar(i, j, "▓");
}
if (Init_Map[i][j] == 红土墙)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_RED);
Map::WriteChar(i, j, "▓");
}
if (Init_Map[i][j] == 水流)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | BACKGROUND_BLUE | FOREGROUND_BLUE | FOREGROUND_GREEN);
Map::WriteChar(i, j, "~");
}
if (Init_Map[i][j] == 钢墙)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN| FOREGROUND_RED | FOREGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE);
Map::WriteChar(i, j, "■");
}
if (Init_Map[i][j] == 老家)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
Map::Map::WriteChar(37, 19, "◣★◢");
Map::WriteChar(38, 19, "███");
Map::WriteChar(39, 19, "◢█◣");
}
Map::Colors(黑色);
}
}
}
void tool::menu()
{
COORD Coord[3];
const char mu[3][16] =
{
" ",
"1 PLAYER",
"2 PLAYERS",
};
for (int i = 0; i < 3; i++)
{
Coord[i].Y = 24;
}
Coord[0].X = 23;
Coord[1].X = 25;
Coord[2].X = 27;
for (int i = 0; i < 3; i++)
{
Map::WriteChar(Coord[i].X, Coord[i].Y, mu[i]);
}
Map::Colors(绿色);
Map::WriteChar(Coord[1].X, Coord[1].Y, mu[1]);
int Select = 1;
while (1)
{
if (GetAsyncKeyState(\'W\') & 0x8001)
{
Map::Colors(白色);
Map::WriteChar(Coord[Select].X, Coord[Select].Y, mu[Select]);
if (Select == 1)
Select = 2;
else
Select--;
Map::Colors(绿色);
Map::WriteChar(Coord[Select].X, Coord[Select].Y, mu[Select]);
}
else if (GetAsyncKeyState(\'S\') & 0x8001)
{
Map::Colors(白色);
Map::WriteChar(Coord[Select].X, Coord[Select].Y, mu[Select]);
if (Select == 2)
Select = 1;
else
Select++;
Map::Colors(绿色);
Map::WriteChar(Coord[Select].X, Coord[Select].Y, mu[Select]);
}
else if (GetAsyncKeyState(0xD) & 0x8001)//回车键
{
switch (Select)
{
case 1:Game::play = 1; break;
case 2:Game::play = 2; break;
default:
break;
}
return;
}
Sleep(200);
}
}
坦克类
#include "Tank.h"
#include "Map.h"
#pragma comment(lib,"winmm.lib")
//坦克mode模型的三维数组
const char* tank_figure[6][3][4] =
{
{
{"█┃ █", "█┳ █", "███", "███"},
{"█●█", "█●█", "━ ●┫", "┣ ●━"},
{"█┻ █", "█┃ █", "███", "███"}
},
{
{"◢┃ ◣", "◢━ ◣", "◢┳ ◣", "◢┳ ◣"},
{"┣ ●┫", "┣ ●┫", "━ ●┃", "┃ ●━"},
{"◥━ ◤", "◥┃ ◤", "◥┻ ◤", "◥┻ ◤"}
},
{
{"┏ ┃ ┓", "┏ ┳ ┓", "┏ ┳ ┓", "┏ ┳ ┓"},
{"┣ ●┫", "┣ ●┫", "━ ●┫", "┣ ●━"},
{"┗ ┻ ┛", "┗ ┃ ┛", "┗ ┻ ┛", "┗ ┻ ┛"}
},
{
{"┏ ┃ ┓", "◢━ ◣", "┏ ┳ ◣", "◢┳ ┓"},
{"┣ ●┫", "┣ ●┫", "━ ●┃", "┃ ●━"},
{"◥━ ◤", "┗ ┃ ┛", "┗ ┻ ◤", "◥┻ ┛"}
},
{
{"╔ ┃ ╗", "╔ ╦ ╗", "╔ ╦ ╗", "╔ ╦ ╗"},
{"╠ █╣", "╠ █╣", "━ █╣", "╠ █━"},
{"╚ ╩ ╝", "╚ ┃ ╝", "╚ ╩ ╝", "╚ ╩ ╝"}
},
{
{" ■ ", "■ ■", " ■■", "■■ "},
{"■●■", "■●■", "■● ", " ●■"},
{"■ ■", " ▉ ", " ■■", "■■ "}
}
};
//坦克构造
Tank::Tank(COORD pos, DIR dir,int mode,int team)
{
//坐标
this->pos = pos;
//方向
this->dir = dir;
//图案模型
this->mode = mode;
//阵营
this->team = team;
//时间坦克移动
this->CD = 150;
this->end_time = clock();
this->music = clock();
//坦克分数
this->score = 0;
//打印坦克
Show_Tank();
}
//打印坦克
void Tank::Show_Tank()
{
const char* (*tankModel)[4] = tank_figure[mode];
for (int i = 0; i < 3; i++)
{
//敌方坦克需要彩色,来区别
if (team == 3)
{
Map::Colors(rand()%7+2);
}
else
{
Map::Colors(紫色);
}
Map::WriteChar(pos.X-1+i,pos.Y-1,tankModel[i][dir]);
Map::dynamic[pos.X - 1 + i][pos.Y - 1] = 坦克;
Map::dynamic[pos.X - 1 + i][pos.Y ] = 坦克;
Map::dynamic[pos.X - 1 + i][pos.Y+1] = 坦克;
}
}
//清理坦克
void Tank::Clear_Tank()
{
for (int i = 0; i < 3; i++)
{
Map::WriteChar(pos.X - 1 + i, pos.Y - 1, " ");
Map::dynamic[pos.X - 1 + i][pos.Y - 1] = 空地;
Map::dynamic[pos.X - 1 + i][pos.Y] = 空地;
Map::dynamic[pos.X - 1 + i][pos.Y + 1] = 空地;
}
}
//坦克移动
void Tank::Move_Tank(DIR dir)
{
//移动坦克之前检查CD是否冷却
if (Check_End_Time())
{
//清理坦克
Clear_Tank();
//检查方向是否一致
if (this->dir != dir)
{
this->dir = dir;
Show_Tank();
return;
}
else
{
//检查是否可以移动
if (if_Move_Tank())
{
switch (dir)
{
case 上:pos.X--;
break;
case 下:pos.X++;
break;
case 左:pos.Y--;
break;
case 右:pos.Y++;
break;
default:
break;
}
}
}
Show_Tank();
}
}
//坦克移动判断
bool Tank::if_Move_Tank()
{
if (dir == 上)
{
return Collide_Check({ pos.X - 2,pos.Y - 1 }) && Collide_Check({ pos.X - 2,pos.Y }) && Collide_Check({pos.X-2,pos.Y+1});
}
if (dir == 下)
{
return Collide_Check({ pos.X + 2,pos.Y - 1 }) && Collide_Check({ pos.X + 2,pos.Y }) && Collide_Check({ pos.X + 2,pos.Y + 1 });
}
if (dir == 左)
{
return Collide_Check({ pos.X -1,pos.Y - 2 }) && Collide_Check({ pos.X ,pos.Y -2}) && Collide_Check({ pos.X + 1,pos.Y - 2 });
}
if (dir == 右)
{
return Collide_Check({ pos.X + 1,pos.Y + 2 }) && Collide_Check({ pos.X,pos.Y + 2}) && Collide_Check({ pos.X - 1,pos.Y + 2 });
}
return false;
}
//辅助坦克移动判断检测
bool Tank::Collide_Check(COORD pos)
{
if (Map::static_Map[pos.X][pos.Y] == 空地 && Map::dynamic[pos.X][pos.Y] != 坦克)
{
return true;
}
return false;
}
//CD检测
bool Tank::Check_End_Time()
{
if (clock() - end_time > this->CD)
{
end_time = clock();
return true;
}
return false;
}
//坦克开火
void Tank::Play_Bullet(std::vector<Bullet*>& bull)
{
/*if (pos.X == 2)
{
return;
}*/
Sleep(100);
//播放发子弹音乐D:\Project\TEST_ONE\Music
Bullet* bullet = new Bullet(this->pos,this-> dir,this->team);
bull.push_back(bullet);
//PlaySoundA("D:\\Project\\TEST_ONE\\Music\\boom.wav", NULL, SND_ASYNC | SND_FILENAME);
}
子弹类
#include "Bullet.h"
#include "Game.h"
#include <conio.h>
#pragma comment(lib,"winmm.lib")
//如果子弹遇到水流后loc=1,
int loc;
//子弹类构造函数
Bullet::Bullet(COORD pos,DIR dir,int team)
{
//子弹坐标初始化
this->pos = pos;
//子弹方向初始化
this->dir = dir;
//子弹存活
this->alive = true;
//子弹阵营
this->team = team;
//检查子弹赋值前的地方是否为边框
if (dir == 上)
{
if (Map::static_Map[this->pos.X - 2][this->pos.Y] == 边框)
{
alive = false;
}
}
else if (dir == 下)
{
if (Map::static_Map[this->pos.X + 2][this->pos.Y] == 边框)
{
alive = false;
}
}
else if (dir == 左)
{
if (Map::static_Map[this->pos.X][this->pos.Y - 2] == 边框)
{
alive = false;
}
}
else if (dir == 右)
{
if (Map::static_Map[this->pos.X][this->pos.Y + 2] == 边框)
{
alive = false;
}
}
if (alive == true)
{
if (Gps_Bullet_1())
{
switch (dir)
{
case 上:this->pos.X -= 2;
break;
case 下:this->pos.X += 2;
break;
case 左:this->pos.Y -= 2;
break;
case 右:this->pos.Y += 2;
break;
default:
break;
}
//Show_bullet();
}
}
}
//子弹移动
void Bullet::Move()
{ //清理子弹
Clear_Bullet();
//检测能否移动
if (Gps_Bullet())
{//如果经过水流
if (loc >= 1)
{
for (int x = 0; x < 41; x++)
{
for (size_t i = 0; i < 41; i++)
{
if (Map::static_Map[x][i] == 水流)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | BACKGROUND_BLUE | FOREGROUND_BLUE | FOREGROUND_GREEN);
Map::WriteChar(x, i, "~");
}
}
}
loc--;
}
switch (dir)
{
case 上:this->pos.X -= 1;
break;
case 下:this->pos.X += 1;
break;
case 左:this->pos.Y -= 1;
break;
case 右:this->pos.Y += 1;
break;
default:
break;
}
Show_bullet();
}
else
{
alive = false;
}
}
//子弹坐标设置
bool Bullet::Gps_Bullet_1()
{
if (dir == 上)
{
return check({ this->pos.X - 2,this->pos.Y });
}
if (dir == 下)
{
return check({ this->pos.X + 2,this->pos.Y });
}
if (dir == 左)
{
return check({ this->pos.X ,this->pos.Y - 2 });
}
if (dir == 右)
{
return check({ this->pos.X ,this->pos.Y + 2 });
}
return false;
}
bool Bullet::Gps_Bullet()
{
if (dir == 上)
{
return check({ this->pos.X - 1,this->pos.Y });
}
if (dir == 下)
{
return check({ this->pos.X + 1,this->pos.Y });
}
if (dir == 左)
{
return check({ this->pos.X ,this->pos.Y - 1 });
}
if (dir == 右)
{
return check({ this->pos.X ,this->pos.Y + 1 });
}
return false;
}
//碰撞检测
bool Bullet::check(COORD pos)
{
////播放发子弹音乐D:\Project\TEST_ONE\Music
//PlaySoundA("D:\\Project\\TEST_ONE\\Music\\hit.wav", NULL, SND_ASYNC |SND_NODEFAULT);
if (Map::static_Map[pos.X][pos.Y] == 老家)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_INTENSITY);
Map::WriteChar(37, 19, "◢ ◣");
Map::WriteChar(38, 19, " █ ");
Map::WriteChar(39, 19, "◥ ◤");
Sleep(1000);
//清理地图
Map::Clear_Map();
//改变标记
this->Home = false;
//将标记传入输赢检测
vin(this->Home);
//输出老家被毁
Map::Clear_Map();
Map::Colors(红色);
Map::WriteChar(20, 20, "老家被毁");
Sleep(1000);
return false;
}
if (Map::static_Map[pos.X][pos.Y] == 边框)
{
return false;
}
if (Map::dynamic[pos.X][pos.Y] == 坦克)
{
//由于判断体较长,所以封装陈函数
Over_Tank({pos.X,pos.Y});
//检测输入,看哪一方先死全
vin();
return false;
}
if (Map::dynamic[pos.X][pos.Y] == 子弹)
{
for (int x = 0; x < Game::bull.size(); x++)
{
if (Game::bull[x]->pos.X == pos.X && Game::bull[x]->pos.Y == pos.Y)
{
Game::bull[x]->Clear_Bullet();
Game::bull[x]->alive = false;
}
}
return false;
}
if (Map::static_Map[pos.X][pos.Y] == 空地 && Map::dynamic[pos.X][pos.Y] == 空地)
{
return true;
}
else if (Map::static_Map[pos.X][pos.Y] == 黄土墙)
{
Map::static_Map[pos.X][pos.Y] = 红土墙;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_RED);
Map:: WriteChar(pos.X, pos.Y, "▓");
return false;
}
else if (Map::static_Map[pos.X][pos.Y] == 水流)
{
loc = 2;
return true;
}
else if (Map::static_Map[pos.X][pos.Y] == 红土墙)
{
if (dir == 左 || dir == 右)
{
if (Map::static_Map[pos.X - 1][pos.Y] == 红土墙)
{
Map::static_Map[pos.X - 1][pos.Y] = 空地;
Map::WriteChar(pos.X - 1, pos.Y, " ");
}
if (Map::static_Map[pos.X + 1][pos.Y] == 红土墙)
{
Map::static_Map[pos.X + 1][pos.Y] = 空地;
Map::WriteChar(pos.X + 1, pos.Y, " ");
}
Map::static_Map[pos.X][pos.Y] = 空地;
Map::WriteChar(pos.X, pos.Y, " ");
}
if (dir == 上 || dir == 下)
{
if (Map::static_Map[pos.X][pos.Y - 1] == 红土墙)
{
Map::static_Map[pos.X][pos.Y - 1] = 空地;
Map::WriteChar(pos.X, pos.Y - 1, " ");
}
if (Map::static_Map[pos.X][pos.Y + 1] == 红土墙) {
Map::static_Map[pos.X][pos.Y + 1] = 空地;
Map::WriteChar(pos.X, pos.Y + 1, " ");
}
Map::static_Map[pos.X][pos.Y] = 空地;
Map::WriteChar(pos.X, pos.Y, " ");
}
return false;
}
return false;
}
//打印子弹
void Bullet::Show_bullet()
{
Map::Colors(绿色);
Map::WriteChar(pos.X, pos.Y, "⊙");
Map::dynamic[pos.X][pos.Y] = 子弹;
}
//清理子弹
void Bullet::Clear_Bullet()
{
Sleep(30);
Map::WriteChar(pos.X,pos.Y," ");
Map::dynamic[pos.X][pos.Y] = 空地;
}
//清理坦克(死亡)
void Bullet::Clear_Tank(COORD pos)
{
for (int i = 0; i < 3; i++)
{
Map::WriteChar(pos.X - 1 + i, pos.Y - 1, " ");
Map::WriteChar(pos.X - 1 + i, pos.Y , " ");
Map::WriteChar(pos.X - 1 + i, pos.Y + 1, " ");
Map::dynamic[pos.X - 1 + i][pos.Y - 1] = 空地;
Map::dynamic[pos.X - 1 + i][pos.Y] = 空地;
Map::dynamic[pos.X - 1 + i][pos.Y + 1] = 空地;
}
}
//坦克得分
void Bullet::Show_Score(int n1,int n2)
{
if (n1 == 0 && n1 ==0)
{
if (team == 1)
{
Game::user1->score += 100;
Map::WriteInt(7, 52, Game::user1->score);
}
if (team == 2)
{
Game::user2->score += 100;
Map::WriteInt(10, 52, Game::user2->score);
}
}
if(n1 != 0||n2 !=0)
{
system("cls");
if (Game::play == 1)
{
Map::WriteChar(20, 22, "1P 总得分:");
Map::WriteInt(20, 28, n1);
system("pause");
}
if (Game::play==2)
{
Map::WriteChar(20,22,"1P 总得分:");
Map::WriteChar(22, 22, "2P 总得分:");
Map::WriteInt(20, 28, n1);
Map::WriteInt(22, 28,n2);
system("pause");
}
}
}
//剩余坦克复活次数
void Bullet::Show_Revive()
{
if (Game::play == 1)
{
Map::WriteInt(8, 52, Game::Revive_User1);
}
else if (Game::play == 2)
{
Map::WriteInt(8, 52, Game::Revive_User1);
Map::WriteInt(11, 52, Game::Revive_User2);
}
}
//坦克死亡
bool Bullet::Over_Tank(COORD pos)
{
//判断子弹碰到的坦克是AI1,AI2,AI3,user1,user2
for (int i = 0; i < 3; i++)
{
//判断克能AI剩余数为0,对象是否被销毁
if (Game::AI1 != nullptr)
{
if (//如果是AI1
pos.X == Game::AI1->pos.X - 1 + i && pos.Y == Game::AI1->pos.Y - 1 ||
pos.X == Game::AI1->pos.X - 1 + i && pos.Y == Game::AI1->pos.Y ||
pos.X == Game::AI1->pos.X - 1 + i && pos.Y == Game::AI1->pos.Y + 1
)
{ //判断击中AI1的子弹是不是同一个阵营
if (team == Game::AI1->team)
{//如果是,则直接返回
return false;
}
else
{//如果不是就在屏幕上擦除
Clear_Tank({ Game::AI1->pos.X, Game::AI1->pos.Y });
//让AI1回到起始位置
if (Game::AI_Tank_Num > 0)
{
Show_Score();
Game::AI1->mode = rand() % 4 + 2;
Game::AI1->pos = { 2,2 };
Game::AI_Tank_Num--;
Map::WriteChar(5, 51, " ");
Map::WriteInt(5, 52, Game::AI_Tank_Num);
}
else
{
Show_Score();
delete Game::AI1;
Game::AI1 = nullptr;
}
}
}
}
//判断克能AI剩余数为0,对象是否被销毁
if (Game::AI2 != nullptr)
{
if (
pos.X == Game::AI2->pos.X - 1 + i && pos.Y == Game::AI2->pos.Y - 1 ||
pos.X == Game::AI2->pos.X - 1 + i && pos.Y == Game::AI2->pos.Y ||
pos.X == Game::AI2->pos.X - 1 + i && pos.Y == Game::AI2->pos.Y + 1
)
{
if (team == Game::AI2->team)
{
return false;
}
else
{
Clear_Tank({ Game::AI2->pos.X, Game::AI2->pos.Y });
if (Game::AI_Tank_Num > 0)
{
Show_Score();
Game::AI2->mode = rand() % 4 + 2;
Game::AI2->pos.X = 2;
Game::AI2->pos.Y = 20;
Game::AI_Tank_Num--;
Map::WriteChar(5, 52, " ");
Map::WriteInt(5, 52, Game::AI_Tank_Num);
}
else
{
Show_Score();
delete Game::AI2;
Game::AI2 = nullptr;
}
}
}
}
//判断克能AI剩余数为0,对象是否被销毁
if (Game::AI3 != nullptr)
{
if (
pos.X == Game::AI3->pos.X - 1 + i && pos.Y == Game::AI3->pos.Y - 1 ||
pos.X == Game::AI3->pos.X - 1 + i && pos.Y == Game::AI3->pos.Y ||
pos.X == Game::AI3->pos.X - 1 + i && pos.Y == Game::AI3->pos.Y + 1
)
{
if (team == Game::AI3->team)
{
return false;
}
else
{
Clear_Tank({ Game::AI3->pos.X, Game::AI3->pos.Y });
if (Game::AI_Tank_Num > 0)
{
Show_Score();
Game::AI2->mode = rand() % 4 + 2;
Game::AI3->pos.X = 2;
Game::AI3->pos.Y = 38;
Game::AI_Tank_Num--;
Map::WriteChar(5, 52, " ");
Map::WriteInt(50, 52, Game::AI_Tank_Num);
}
else
{
Show_Score();
delete Game::AI3;
Game::AI3 = nullptr;
}
}
}
}
if (Game::user1 != nullptr)
{
if (//如果是user1
pos.X == Game::user1->pos.X - 1 + i && pos.Y == Game::user1->pos.Y - 1 ||
pos.X == Game::user1->pos.X - 1 + i && pos.Y == Game::user1->pos.Y ||
pos.X == Game::user1->pos.X - 1 + i && pos.Y == Game::user1->pos.Y + 1
)
{ //判断击中AI1的子弹是不是同一个阵营
if (team == Game::user1->team)
{//如果是,则直接返回
return false;
}
else
{//如果是就在屏幕上擦除
Clear_Tank({ Game::user1->pos.X, Game::user1->pos.Y });
if (Game::Revive_User1 == 0)
{
//Show_Score(Game::user1->score);
delete Game::user1;
Game::user1 = nullptr;
}
else
{
Show_Revive();
//玩家1复活次数减1
Game::Revive_User1--;
Show_Revive();
//让user1回到起始位置
Game::user1->pos = { 38,14 };
for (int i = 0; i < 3; i++)
{
Map::Colors(紫色);
Map::WriteChar(37 + i, 13, Map::tank_user1[i]);
}
}
}
}
}
if (Game::play == 2)
{
if (Game::user2 != nullptr)
{
if (//如果是user2
pos.X == Game::user2->pos.X - 1 + i && pos.Y == Game::user2->pos.Y - 1 ||
pos.X == Game::user2->pos.X - 1 + i && pos.Y == Game::user2->pos.Y ||
pos.X == Game::user2->pos.X - 1 + i && pos.Y == Game::user2->pos.Y + 1
)
{ //判断击中user2的子弹是不是同一个阵营
//由于可能出现玩家死亡,所以不能使用空指针,直接使用值1
if (team == Game::user2->team || team==1)
{//如果是,则直接返回
return false;
}
else
{
//如果是就在屏幕上擦除
Clear_Tank({ Game::user2->pos.X, Game::user2->pos.Y });
if (Game::Revive_User2 == 0)
{
delete Game::user2;
Game::user2 = nullptr;
}
else
{
//玩家2复活次数减1
Game::Revive_User2--;
Show_Revive();
//让user2回到起始位置
Game::user2->pos = { 38,26 };
for (int i = 0; i < 3; i++)
{
Map::Colors(紫色);
Map::WriteChar(37 + i, 25, Map::tank_user2[i]);
}
}
}
}
}
}
}
}
//检测输赢
void Bullet::vin(bool Home)
{
if (Game::AI1 == nullptr && Game::AI2 == nullptr && Game::AI3 == nullptr)
{
Map::Clear_Map();
//说明全部通关
if (Map::Level == 8)
{
Map::WriteChar(20, 15, "恭喜,全部通关\n");
Sleep(3000);
}
else
{
Map::WriteChar(20, 15, "玩家胜利,即将进入下一关卡\n");
Map::dynamic[41][41] = { 0 };
Game::Level_Loc = true;
if (Game::play == 1)
{
Clear_Tank({ Game::user1->pos.X, Game::user1->pos.Y });
}
else
{
Clear_Tank({ Game::user1->pos.X, Game::user1->pos.Y });
Clear_Tank({ Game::user2->pos.X, Game::user2->pos.Y });
}
Sleep(1500);
}
}
if (Game::play == 2)
{ //如果都等于空,说明玩家死亡,游戏结束
if (Game::user1 == nullptr && Game::user2 == nullptr|| Home==false)
{
//所有数据清空,并返回主菜单
//需要重新进入欢迎界面标记
Game::Over = true;
//如果有AI没死,我们就让他死掉重新初始化
if (Game::AI1 != nullptr)
{
delete Game::AI1;
Game::AI1 = nullptr;
}
if (Game::AI2 != nullptr)
{
delete Game::AI2;
Game::AI2 = nullptr;
}
if (Game::AI3 != nullptr)
{
delete Game::AI3;
Game::AI3 = nullptr;
}
//把动态地图清空
for (int x = 0; x < 41; x++)
{
for (int i = 0; i < 41; i++)
{
Map::dynamic[x][i] = 0;
}
}
}
}
else if (Game::play == 1)
{
if (Game::user1 == nullptr || Home == false)
{
//所有数据清空,并返回主菜单
Game::Over = true;
if (Game::AI1 != nullptr)
{
delete Game::AI1;
Game::AI1 = nullptr;
}
if (Game::AI2 != nullptr)
{
delete Game::AI2;
Game::AI2 = nullptr;
}
if (Game::AI3 != nullptr)
{
delete Game::AI3;
Game::AI3 = nullptr;
}
for (int x = 0; x < 41; x++)
{
for (int i = 0; i < 41; i++)
{
Map::dynamic[x][i] = 0;
}
}
}
}
}
地图类(略长)
#include "Map.h"
#include "Game.h"
int Map::static_Map[HIGHT][HIGHT] = {};
int Map::dynamic[HIGHT][WIDTH] = {};
char Map::Type;
//关卡地图初始化
int Map::Level = 1;
//用于副屏幕模型显示
const char* Map::tank_user1[3] =
{
{ "█┃ █"},
{ "█●█"},
{ "█┻ █"}
};
const char* Map::tank_user2[3]{
{"◢┃ ◣" },
{"┣ ●┫"},
{"◥━ ◤" }
};
void Map::Init_Map()
{
int i, j;
int Map[9][41][41] =
{
{//钢墙白色■值为6,,土墙黄色▓值为2 ,土墙红▓值为1,海蓝色~值为5 ,普通白(老家)值为9
{4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4},
{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},
{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},
{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},
{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},
{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},
{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},
{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},
{4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,5,5,5,5,0,0,0,4},
{4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},
{4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},
{4,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4},
{4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},
{4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},
{4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,9,9,9,1,1,0,0,0,0,0,0,0,1,1,1,6,6,6,0,0,0,4},
{4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4}
},
};
for (i = 0; i < HIGHT; i++)
{
for (j = 0; j < WIDTH; j++)
{
static_Map[i][j] = Map[Level][i][j];
//初始化边框
if (static_Map[i][j] == 边框)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN| FOREGROUND_RED | FOREGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE);
WriteChar(i, j, "■");
}
Colors(绿色);
if (static_Map[i][j] == 黄土墙)//被击中变成红土墙
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_RED);
WriteChar(i, j, "▓");
}
if (static_Map[i][j] == 红土墙)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_RED);
WriteChar(i, j, "▓");
}
if (static_Map[i][j] == 水流)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | BACKGROUND_BLUE | FOREGROUND_BLUE | FOREGROUND_GREEN);
WriteChar(i, j, "~");
}
if (static_Map[i][j] == 钢墙)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN| FOREGROUND_RED | FOREGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE);
WriteChar(i, j, "■");
}
if (static_Map[i][j] == 老家)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_GREEN);
WriteChar(37,19,"◣★◢");
WriteChar(38, 19, "███");
WriteChar(39, 19, "◢█◣");
}
Colors(黑色);
}
}
}
//在屏幕输出字符
void Map::WriteChar(short x, short y, const char* chr)
{
//获取屏幕输出句柄
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
//获取输出坐标
SetConsoleCursorPosition(hOut, { y * 2 , x } );
//输出相应的字符
printf(chr);
}
//在屏幕输出变量
void Map::WriteInt(short x, short y, int i)
{
//获取屏幕输出句柄
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
//获取输出坐标
SetConsoleCursorPosition(hOut, { y * 2 , x });
//输出相应的字符
printf("%d",i);
}
//颜色选择函数
void Map::Colors(int color)
{
switch (color)
{
case 1: //天蓝色(我的坦克颜色)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE);
break;
case 2: //绿色
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
break;
case 3: //黄色
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);
break;
case 4: //红色
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
break;
case 5: //紫色
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE);
break;
case 6: //白色
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN);
break;
case 7: //深蓝色(∵颜色深难与黑色背景辨识度不高 ∴坦克颜色不选用此颜色),只用在字体颜色闪烁中
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_BLUE);
break;
}
}
//副屏幕显示信息
void Map::Init_Info()
{
Colors(白色);
//关卡
WriteChar(2, 46, " ◣");
WriteChar(3,44,"关卡 |");
if(Level !=0)
WriteInt(3,50,Level);
else{WriteChar(3, 50, "自定义地图 "); }
WriteChar(5, 44, "剩余敌方坦克: ");
WriteInt(5,52,Game::AI_Tank_Num);
if (Game::play == 1)
{
WriteChar(7,44,"1P PLAY 得分: 0");
WriteChar(8,44,"生命数: ");
WriteInt(8, 52, Game::Revive_User1);
WriteChar(26, 44, "模式:单人模式");
WriteChar(28, 44, "1P PLAY");
WriteChar(30, 44, "游戏键位");
WriteChar(33, 46, "W");
WriteChar(34, 44, "A S D J");
}
else
{
WriteChar(7, 44, "1P PLAY 得分: 0");
WriteChar(10, 44, "2P PLAY 得分: 0");
WriteChar(8, 44, "生命数:");
WriteInt(8, 52, Game::Revive_User1);
WriteChar(11, 44, "生命数:");
WriteInt(11, 52, Game::Revive_User2);
WriteChar(25, 44, "游戏键位");
WriteChar(23, 44, "模式:双人模式");
WriteChar(27, 44, "1P PLAY");
WriteChar(30, 46, "W");
WriteChar(31, 44, "A S D J");
WriteChar(33, 44, "2P PLAY");
WriteChar(36, 45, " ↑");
WriteChar(37, 43, "← ↓ → Insert");
}
for (int i = 0; i < 3; i++)
{
Colors(紫色);
if (Game::play == 1)
WriteChar(28 + i, 50, tank_user1[i]);
else if (Game::play == 2)
{
WriteChar( 27+ i, 50, tank_user1[i]);
WriteChar(33 + i, 50, tank_user2[i]);
}
}
WriteChar(17, 44, "正在游戏中。。。");
WriteChar(19, 44, "SPACE空格暂停");
}
//选择坦克模型与颜色
void Map::print_Tank_Mode()
{
for (int i = 0; i < 3; i++)
{
Colors(紫色);
if (Game::play == 1)
WriteChar(37 + i, 13, tank_user1[i]);
else if (Game::play == 2)
{
WriteChar(37 + i, 13, tank_user1[i]);
WriteChar(37 + i, 25, tank_user2[i]);
}
}
}
//自己写一个清理主地图函数
void Map::Clear_Map()
{
for (int x=1;x<41;x++)
{
for (int i = 0; i < 41; i++)
{
WriteChar(x,i," ");
}
}
}
//打印副屏幕框架
void Map::fu_map()
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN
| FOREGROUND_RED | FOREGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE);
WriteChar(0,42,"■■■■■■■■■■■■■");
WriteChar(13, 42, "■■■■■■■■■■■■■");
WriteChar(21, 42, "■■■■■■■■■■■■■");
WriteChar(40, 42, "■■■■■■■■■■■■■");
for (int x=0;x<41;x++)
{
WriteChar( x,41, "■");
WriteChar( x,55, "■");
}
}
//自定义地图信息显示
void Map::Show_Diy_Info()
{
Colors(白色);
WriteChar(2, 47, "红土墙");
WriteChar(8, 47, "黄土墙");
WriteChar(14, 47, "钢墙");
WriteChar(20, 47, "水流");
WriteChar(26, 46, "空地/删除");
WriteChar(34, 44, "保存地图并开始游戏");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_RED);
WriteChar(3,44,"▓▓▓▓▓▓▓▓▓");
WriteChar(4, 44, "▓▓▓▓▓▓▓▓▓");
WriteChar(5, 44, "▓▓▓▓▓▓▓▓▓");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_RED);
WriteChar(9, 44, "▓▓▓▓▓▓▓▓▓");
WriteChar(10, 44, "▓▓▓▓▓▓▓▓▓");
WriteChar(11, 44, "▓▓▓▓▓▓▓▓▓");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN
| FOREGROUND_RED | FOREGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE);
WriteChar(15, 44, "■■■■■■■■■");
WriteChar(16, 44, "■■■■■■■■■");
WriteChar(17, 44, "■■■■■■■■■");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | BACKGROUND_BLUE | FOREGROUND_BLUE | FOREGROUND_GREEN);
WriteChar(21, 44, "~~~~~~~~~");
WriteChar(22, 44, "~~~~~~~~~");
WriteChar(23, 44, "~~~~~~~~~");
Colors(绿色);
WriteChar(27, 44, "------------------");
WriteChar(28, 44, "| |");
WriteChar(29, 44, "| |");
WriteChar(30, 44, "------------------");
WriteChar(39, 44, "注意:‘右击模块选择’");
WriteChar(40, 44, " ‘左击释放’");
Colors(白色);
WriteChar(35, 44, "■■■■■■■■■");
WriteChar(36, 44, "■■■■■■■■■");
WriteChar(37, 44, "■■■■■■■■■");
}
游戏控制类Game(巨长)
#include "Game.h"
std::vector<Bullet*>Game::bull;
Tank* Game::user1;
Tank* Game::user2;
Tank* Game::AI1;
Tank* Game::AI2;
Tank* Game::AI3;
//用于区别单人模式和双人模式做一个记号,值为1代表单人,2为双人
int Game::play;
//是否进入下一关卡
bool Game::Level_Loc=false;
//剩余敌方坦克数量,总值为20,因首次初始化敌方坦克数量3
int Game::AI_Tank_Num=0;
//玩家剩余复活次数2次
int Game::Revive_User1=2;
int Game::Revive_User2=2;
//游戏结束标记
bool Game::Over=false;
//结束鼠标接收标记
bool Game::end = true;
//检测输入,AI随机
void Game::Input()
{
/*---------------------------------------------------------------------*/
////100分之30的几率改变,不能太频繁,否则AI跟疯了是的,也会造成负荷
if (AI1 != nullptr)
{
//4/10几率改变
AI1->dir = (DIR)(rand() % 7);
switch (AI1->dir)
{
case 0:AI1->Move_Tank(上); break;
case 1:case 4:case 5:case 6:AI1->Move_Tank(下); break;
case 2:AI1->Move_Tank(左); break;
case 3:AI1->Move_Tank(右); break;
default:
break;
}
//地方坦克开火有20分之1的几率开炮,测试了几次开炮不能过于频繁
if (AI1->frie = rand() % 25 == 1)
{
AI1->Play_Bullet(bull);
}
}
if (AI2 != nullptr)
{
AI2->dir = (DIR)(rand() % 7);
switch (AI2->dir)
{
case 0:AI2->Move_Tank(上); break;
case 1:case 4:case 5:case 6:AI2->Move_Tank(下); break;//增大向下走的概率
case 2:AI2->Move_Tank(左); break;
case 3:AI2->Move_Tank(右); break;
default:
break;
}
if (AI2->frie = rand() % 25 == 1)
{
AI2->Play_Bullet(bull);
}
}
if (AI3 != nullptr)
{
AI3->dir = (DIR)(rand() % 7);
switch (AI3->dir)
{
case 0:AI3->Move_Tank(上); break;
case 1:case 4:case 5:case 6:AI3->Move_Tank(下); break;
case 2:AI3->Move_Tank(左); break;
case 3:AI3->Move_Tank(右); break;
default:
break;
}
if (AI3->frie = rand() % 25 == 1)
{
AI3->Play_Bullet(bull);
}
}
if (play == 1)
{
if (user1 != nullptr)
{
if (GetAsyncKeyState(\'W\') & 0x8001)
user1->Move_Tank(上);
if (GetAsyncKeyState(\'S\') & 0x8001)
user1->Move_Tank(下);
if (GetAsyncKeyState(\'A\') & 0x8001)
user1->Move_Tank(左);
if (GetAsyncKeyState(\'D\') & 0x8001)
user1->Move_Tank(右);
if (GetAsyncKeyState(\'J\') & 0x8001)
user1->Play_Bullet(bull);
if (GetAsyncKeyState(VK_SPACE) & 0x8000)
Game_Stop();
}
}
else if(play==2)
{
if (user1 != nullptr)
{
if (GetAsyncKeyState(\'W\') & 0x8001)
user1->Move_Tank(上);
if (GetAsyncKeyState(\'S\') & 0x8001)
user1->Move_Tank(下);
if (GetAsyncKeyState(\'A\') & 0x8001)
user1->Move_Tank(左);
if (GetAsyncKeyState(\'D\') & 0x8001)
user1->Move_Tank(右);
if (GetAsyncKeyState(\'J\') & 0x8001)
user1->Play_Bullet(bull);
if (GetAsyncKeyState(VK_SPACE) & 0x8001)
Game_Stop();
}
if (user2 != nullptr)
{
if (GetAsyncKeyState(VK_UP) & 0x8001)
user2->Move_Tank(上);
if (GetAsyncKeyState(VK_DOWN) & 0x8001)
user2->Move_Tank(下);
if (GetAsyncKeyState(VK_LEFT) & 0x8001)
user2->Move_Tank(左);
if (GetAsyncKeyState(VK_RIGHT) & 0x8001)
user2->Move_Tank(右);
if (GetAsyncKeyState(VK_INSERT) & 0x8001)
user2->Play_Bullet(bull);
}
}
}
//调用子弹移动,且存储子弹和删除
void Game::Move_Bullet()
{
for (unsigned int i = 0; i < bull.size(); i++)
{
if (bull[i]->alive == true)
{
bull[i]->Move();
}
else
{
bull.erase(bull.begin()+i);
i--;
}
}
}
//菜单输出控制
void Game::Input_Menu()
{
for (int i = 0; i < 6; i++)
{
menu.Coord[i].Y = 24;
}
menu.Coord[0].X = 23;
menu.Coord[1].X = 25;
menu.Coord[2].X= 27;
menu.Coord[3].X = 29;
menu.Coord[4].X = 31;
menu.Coord[5].X = 33;
menu.Show_Menu();
for (int i = 0; i < 6; i++)
{
Map::WriteChar(menu.Coord[i].X, menu.Coord[i].Y, menu.mu[i]);
}
Map::Colors(绿色);
Map::WriteChar( menu.Coord[1].X,menu.Coord[1].Y, menu.mu[1]);
int Select = 1;
while (1)
{
if (GetAsyncKeyState(\'W\') & 0x8001)
{
Map::Colors(白色);
Map::WriteChar( menu.Coord[Select].X,menu.Coord[Select].Y, menu.mu[Select]);
if (Select == 1)
Select = 5;
else
{
Select--;////播放发子弹音乐D:\Project\TEST_ONE\Music
PlaySoundA("D:\\Project\\TEST_ONE\\Music\\hit.wav", NULL, SND_ASYNC | SND_NODEFAULT);
}
Map::Colors(绿色);
Map::WriteChar(menu.Coord[Select].X, menu.Coord[Select].Y,menu.mu[Select]);
}
else if (GetAsyncKeyState(\'S\') & 0x8001)
{
Map::Colors(白色);
Map::WriteChar(menu.Coord[Select].X, menu.Coord[Select].Y, menu.mu[Select]);
if (Select == 5)
Select = 1;
else
{
Select++;////播放发子弹音乐D:\Project\TEST_ONE\Music
PlaySoundA("D:\\Project\\TEST_ONE\\Music\\hit.wav", NULL, SND_ASYNC | SND_NODEFAULT);
}
Map::Colors(绿色);
Map::WriteChar( menu.Coord[Select].X,menu.Coord[Select].Y, menu.mu[Select]);
}
else if (GetAsyncKeyState(0xD) & 0x8001)//回车键
{
switch (Select)
{
case 1:start_user1(); break;
case 2:start_user2(); break;
case 3:Load_Game(); break;
case 4:Diy_Map(); break;
case 5:exit(0); break;
default:
break;
}
}
Sleep(200);
}
}
//隐藏光标
void Game::HIdeCur()
{
CONSOLE_CURSOR_INFO cci;
cci.bVisible = false;
cci.dwSize = 1;
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cci);
}
//下一关初始化
void Game::Pass()
{
Sleep(1000);
//清理地图
Map::Clear_Map();
////播放发子弹音乐D:\Project\TEST_ONE\Music
PlaySoundA("D:\\Project\\TEST_ONE\\Music\\background.wav", NULL, SND_ASYNC | SND_NODEFAULT);
//关闭进入下一关标记
Level_Loc = false;
//地图升级
Map::Level ++;
//在副屏幕打印关卡等级
Map::WriteInt(3, 50, Map::Level);
//初始化剩余坦克数量
AI_Tank_Num = 17;
//显示剩余坦克数量
Map::WriteInt(5, 52, AI_Tank_Num);
//创建敌方坦克
AI1 = new Tank({ 2,2 }, 下, rand() % 4 + 2, 3);
AI2 = new Tank({ 2,20 }, 下, rand() % 4 + 2, 3);
AI3 = new Tank({ 2,38 }, 下, rand() % 4 + 2, 3);
//如果当前为单人模式
if(play==1)
user1->pos = { 38,14 };
else//否则双人模式
{
user1->pos = { 38,14 };
user2->pos = { 38,26 };
}
Map::print_Tank_Mode();//打印坦克
Map::Init_Map();//初始化地图
}
//游戏暂停
void Game::Game_Stop()
{
while (true)
{
//打印位置11-23之间,我们还需要一个框架所以最少前后空出1
Map::Colors(白色);
Map::WriteChar(16,44,"游戏暂停中。。。");
Map::WriteChar(17, 44, "输入BACK继续游戏");
Map::WriteChar(18, 44, "输入Esc返回菜单");
Map::WriteChar(19, 44, "回车保存并退出");
//Map::WriteChar(20, 44, "SPACE关闭游戏");
if (GetAsyncKeyState(VK_BACK) & 0x8001)//空格VK_BACK
{
Map::WriteChar(16,44,"正在游戏中。。。");
Map::WriteChar(17, 44, " ");
Map::WriteChar(18, 44, " ");
Map::WriteChar(19, 44, "SPACE空格暂停");
// Map::WriteChar(20, 44, " ");
break;
}
else if(GetAsyncKeyState(VK_RETURN) & 0x8001)//VK_SPACE
{
SaveInfo();
Init_Null();
Sleep(1000);
main();
}
else if(GetAsyncKeyState(0x1B) & 0x8001)//esc键
{
Init_Null();
main();
}
//else if (GetAsyncKeyState(VK_SPACE) & 0x8001)//空格键
//{
// exit(0);
// Sleep(200);
//}
}
}
//当游戏结束,所有值清空
void Game::Init_Null()
{
if (Game::play == 2)
{
if (Game::user1 != nullptr)
{
delete Game::user1;
Game::user1 = nullptr;
}
if (Game::user2 != nullptr)
{
delete Game::user2;
Game::user2 = nullptr;
}
if (Game::AI3 != nullptr)
{
delete Game::AI3;
Game::AI3 = nullptr;
}
if (Game::AI2 != nullptr)
{
delete Game::AI2;
Game::AI2 = nullptr;
}
if (Game::AI3 != nullptr)
{
delete Game::AI3;
Game::AI3 = nullptr;
}
//把动态地图清空
for (int x = 0; x < 41; x++)
{
for (int i = 0; i < 41; i++)
{
Map::dynamic[x][i] = 0;
}
}
//关卡置0
Map::Level = 1;
//敌方坦克复活
AI_Tank_Num = 17;
Revive_User1 = 2;
Revive_User2 = 2;
}
else if (Game::play == 1)
{
if (Game::user1 != nullptr)
{
delete Game::user1;
Game::user1 = nullptr;
}
if (Game::AI3 != nullptr)
{
delete Game::AI3;
Game::AI3 = nullptr;
}
if (Game::AI2 != nullptr)
{
delete Game::AI2;
Game::AI2 = nullptr;
}
if (Game::AI3 != nullptr)
{
delete Game::AI3;
Game::AI3 = nullptr;
}
for (int x = 0; x < 41; x++)
{
for (int i = 0; i < 41; i++)
{
Map::dynamic[x][i] = 0;
}
}
//关卡置0
Map::Level = 1;
//敌方坦克复活
AI_Tank_Num = 17;
Revive_User1 = 2;
}
}
//鼠标事件
void Game::Mouse(MOUSE_EVENT_RECORD event, std::vector<COORD>& pos)
{
//鼠标事件类型
switch (event.dwEventFlags)
{
case 0:
//如果按键的类型为左键被按下
if (event.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED)
{
COORD temp = {event.dwMousePosition.X/2,event.dwMousePosition.Y };
pos.push_back(temp);
Map::WriteChar( temp.Y, temp.X, "■");
}
break;
case DOUBLE_CLICK:
default:
break;
}
}
//自定义地图,接受鼠标事件
void Game::DIY_Map(//std::vector<COORD>& pos
)
{
system("cls");
//进入自定义地图的模式
//打印地图边框及说明
Map::Level = 0;
Map::Init_Map();
Map::Show_Diy_Info();
int type_mode=0;
//接收用户自定义事件
INPUT_RECORD in = {};//定义事件结构体
DWORD read = 0;//存储读取记录
COORD pos = {};//存储鼠标位置
MOUSE_EVENT_RECORD mer;//鼠标事件
HANDLE hOut = GetStdHandle(STD_INPUT_HANDLE);
SetConsoleMode(hOut,ENABLE_MOUSE_INPUT|ENABLE_WINDOW_INPUT);
while (end)
{
//等待事件
ReadConsoleInput(hOut, &in, 1, &read);
//如果是鼠标事件
if (in.EventType == MOUSE_EVENT)
{
//Mouse(in.Event.MouseEvent,pos);
mer = in.Event.MouseEvent;
//鼠标左单击
if (mer.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED)
{
if (mer.dwMousePosition.X >= 2 && mer.dwMousePosition.X <= 78 && mer.dwMousePosition.Y >= 1 && mer.dwMousePosition.Y <= 39)
{
switch (type_mode)
{
case 红土墙:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_RED);
Map::WriteChar(mer.dwMousePosition.Y, mer.dwMousePosition.X / 2, "▓"); break;
case 黄土墙:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | BACKGROUND_GREEN | BACKGROUND_RED);
Map::WriteChar(mer.dwMousePosition.Y, mer.dwMousePosition.X / 2, "▓"); break;
case 钢墙:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN
| FOREGROUND_RED | FOREGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE);
Map::WriteChar(mer.dwMousePosition.Y, mer.dwMousePosition.X / 2, "■"); break;
case 空地:
Map::Colors(白色);
Map::WriteChar(mer.dwMousePosition.Y, mer.dwMousePosition.X / 2, " "); break;
case 水流:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | BACKGROUND_BLUE | FOREGROUND_BLUE | FOREGROUND_GREEN);
Map::WriteChar(mer.dwMousePosition.Y, mer.dwMousePosition.X / 2, "~"); break;
default:
break;
}
Map::static_Map[mer.dwMousePosition.Y][mer.dwMousePosition.X / 2] = type_mode;
for (int x = 0; x < 41; x++)
{
for (int i = 0; i < 41; i++)
{
tool::Init_Map[x][i] = Map::static_Map[x][i];
}
}
}
}
//鼠标右击
else if (mer.dwButtonState == RIGHTMOST_BUTTON_PRESSED)
{
if (mer.dwMousePosition.X >= 44*2&& mer.dwMousePosition.X <= 51 * 2, mer.dwMousePosition.Y >= 3&& mer.dwMousePosition.Y <= 5)
{
type_mode = 红土墙;
}
else if( mer.dwMousePosition.X >=44*2&& mer.dwMousePosition.X <= 51 * 2, mer.dwMousePosition.Y >=9&& mer.dwMousePosition.Y <= 11)
{
type_mode = 黄土墙;
}
else if(mer.dwMousePosition.X >= 44*2&& mer.dwMousePosition.X <= 51 * 2, mer.dwMousePosition.Y >= 15&& mer.dwMousePosition.Y <= 17)
{
type_mode = 钢墙;
}
else if (mer.dwMousePosition.X >= 44*2&& mer.dwMousePosition.X == 51 * 2, mer.dwMousePosition.Y >= 21&& mer.dwMousePosition.Y <= 23)
{
type_mode = 水流;
}
else if (mer.dwMousePosition.X >= 44 * 2 && mer.dwMousePosition.X == 51 * 2, mer.dwMousePosition.Y >= 27 && mer.dwMousePosition.Y <= 30)
{
type_mode = 空地;
}
else if (mer.dwMousePosition.X >= 44 * 2 && mer.dwMousePosition.X == 51 * 2, mer.dwMousePosition.Y >= 35&& mer.dwMousePosition.Y <= 37)
{
//由于用户需要选择单双人模式
return;
}
//printf("%d %d\n", mer.dwMousePosition.X, mer.dwMousePosition.Y);
}
}
}
CloseHandle(hOut);
}
有什么写的不好的地方,请大家键盘留情。