游戏不长,但敲了半个月呢。都是些零碎时间。这只是第一章,剩余章节后续会发上(剧情十分狗血,不喜勿喷。。。。。。)代码中一部分自定义头文件都是我以前发过的,可以从我历史文章中找。接下来上代码。(不要忘记评论、点赞、关注和转发哦~~~)
/*
游戏名称:Interstellar Tracking (第一章)
游戏设计:S_JH330206
剧本设计:S_JH330206、_JH_duangduang
代码实现:S_JH330206
游戏测试:S_JH330206、_JH_duangduang、jd0630
游戏说明:
按键说明:
wsad-移动;
e-打开/关闭坐标数据;
tab-打开/关闭背包;
enter-打开箱子;
jkl-分别为使用背包栏前三个物品(由于本章节只有一个物品即扫描仪,所以没有设计交换背包内物品位置的功能);
图标说明:
墙(颜色不唯一,阻挡玩家行走);
空气(这个不用说,黑色的);
门(带有DR的方块,站上去即可通行)
记录仪(带有RC的方块,站上去即可读取);
箱子(带有BX的方块,enter即可打开/关上,由于本章节只有一个物品,没有设计玩家物品栏与箱子的同屏);
玩家(更不用说了,实在找不到就移动一下);
*/
#include <iostream>
#include <windows.h>
#include "BackGround.h"
#include "ConsoleColor.h"
#include <conio.h>
#include "GotoXY.h"
#include "HideCursor.h"
#define LeftSpace 5
#define UpSpace 2
#define Box 1000000
using namespace std;
int Map[100][100][100]={
0}; // 0 空气 1 墙 2 玩家 3 门 4 记录仪 box 箱子
int px,py;
int d1x,d1y;
int d2x,d2y;
int tx,ty;
bool flag;
bool Fflag;
bool bo;
bool sb;
char ch;
int backpack[1000];//1 scanner
int box[1000][1000];
void Box_1();
void ReCord(int);
void OutPut_Map(int);
void bag_open();
void LOGO();
void scan();
void FL_CT(int);
void BAG(){
GotoXY(12,16);
BackGround(7,0);
for (int i=1;i<=3;i++){
if (backpack[i]){
if (backpack[i]==1){
cout<<"扫描仪";
}
}
else{
cout<<" ";
}
if (i<3)
cout<<"|";
}
}
void scan(){
system("title 扫描结果");
BackGround (3,0);
cout<<"[扫描结果:"<<endl;
Sleep(300);
cout<<"[天绘号残骸"<<endl;
Sleep(300);
cout<<"[舱体完整度:63%"<<endl;
Sleep(300);
cout<<"[已记录至数据库"<<endl;
Sleep(300);
cout<<"[(你没有数据读取器!!!)"<<endl;
Sleep(300);
cout<<"[";
system("pause");
system("cls");
cout<<"[舱体完整度只有63%?"<<endl;
Sleep(300);
cout<<"[舱体破坏相当大"<<endl;
Sleep(300);
cout<<"[还好我们所处区域没有破坏"<<endl;
Sleep(300);
cout<<"[好了,赶紧逃出这是非之地吧"<<endl;
Sleep(2000);
system("cls");
OutPut_Map(3);
Sleep(600);
GotoXY(6,3);
BackGround (7,0);
cout<<" ";
Sleep(1000);
GotoXY(6,3);
BackGround (0,6);
cout<<"控";
BackGround(7,0);
Sleep(1000);
system("cls");
BackGround (3,0);
cout<<"[操控杆已升起,驾驶逃离。"<<endl;
BackGround(7,0);
Sleep(1500);
FL_CT(0);
Sleep(1600);
cout<<endl;
system("pause");
exit(0);
return;
}
void CT_First(){
system("title ") ;
BackGround(3,0);
cout<<"[(记录时间:1990年2月8日, 天绘号运载舰)"<<endl;
Sleep(800);
cout<<"[你是AI机器人"<<endl;
Sleep(800);
cout<<"[编号:03-JH-202128"<<endl;
Sleep(800);
cout<<"[1997年3月1日 船舱爆炸"<<endl;
Sleep(800);
cout<<"[你进入休眠状态......"<<endl;
Sleep(800);
cout<<"[当你看到这段文字"<<endl;
Sleep(800);
cout<<"[你正在实验室中醒来。"<<endl;
Sleep(2500);
BackGround(7,0);
system("cls");
Sleep(400);
return ;
}
void LOGO(){
int logo[5][12]={
//Interstellar Tracking
{
1,1,1,1,1,0,0,1,1,1,1,1},
{
0,0,1,0,0,0,0,0,0,1,0,0},
{
0,0,1,0,0,0,0,0,0,1,0,0},
{
0,0,1,0,0,0,0,0,0,1,0,0},
{
1,1,1,1,1,0,0,0,0,1,0,0},
};
GotoXY(0,0);
for (int i=1;i<=UpSpace;i++){
cout<<endl;
}
for (int i=0;i<5;i++){
for (int j=1;j<=LeftSpace;j++){
BackGround(7,0);
cout<<" ";
}
for (int j=0;j<12;j++){
if (logo[i][j]){
BackGround(0,6);
}
else{
BackGround(7,0);
}
cout<<" ";
}
cout<<endl;
}
GotoXY(0,8);
cout<<"I n t e r s t e l l a r T r a c k i n g ";
Sleep(1500);
system("cls");
int JH[5][12]={
{