星际迷途正式版1.0震撼上市!!!(bug已修复)

#include <iostream>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
#include <windows.h>
using namespace std;
void gotoxy(int x, int y){
	COORD pos = {x,y};
	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(hOut, pos);
	return ;
}
int main(){
	cout<<"星际迷途v2.0 test版本"<<endl;
	cout<<">是你的飞船,@是你的炮弹(使用要达到3级),#是陨石,*是经验"<<endl;
	system("pause");
	system("cls"); 
	MessageBox(NULL, TEXT("欢迎玩星际迷途... 原创 微光@请勿盗用"), TEXT("ok请注意"),MB_OK); 
	MessageBox(NULL, TEXT("请将输入法调制为英文,否则无法正常玩"), TEXT("提示ヾ(?ω?`)o"),MB_OK);
	cout<<"wasd控制运行,空格暂停,e键开炮"<<endl;
	cout<<"小心!躲开那些陨石!!!"<<endl;
	cout<<"吃掉一些经验,也许有奇效。。。";
	Sleep(1500);
	system("cls");
	char map[20][110]={};//定义地图 
	for(int i=0;i<20;i++){
		for(int j=0;j<110;j++){
			map[i][j]=' ';
		}
	}
	for(int i=0;i<110;i++) map[0][i]='-';
	for(int i=0;i<110;i++) map[19][i]='-';
	for(int i=0;i<20;i++) map[i][0]='|';
	for(int i=0;i<20;i++) map[i][109]='|';
	//定义飞船
	srand(time(0));
	int ship_arr=rand()%40+60,ship_row=rand()%15+3;
	int ship_hp=100,level=3;
	int me_row[100],me_arr[100],met=0;
	int me2_row[100],me2_arr[100],met2=0;
	int me3_row[100],me3_arr[100],met3=0;
	int bul_time=1,bul_row,bul_arr;
	int bul2_time=1,bul2_row=15,bul2_arr=100;
	int eship_row=rand()%15+3,eship_arr=108;
	int eship_hp=100;
	srand(time(0));
	int exp_row[30],exp_arr[30],mete=0;
	int ship_exp=0;
	exp_row[0]=rand()%15+3;
	exp_arr[0]=rand()%100+2;
	for(int i=0;i<100;i++){
		me_arr[i]=90+rand()%20-10;
		me2_arr[i]=90+rand()%20-10;
		me3_arr[i]=90+rand()%20-10;
	}
	int k=rand()%6+1;
	me_row[0]=ship_row; 
	me2_row[0]=ship_row+rand()%10+1-7;
	if(me2_row[0]>=18) me2_row[0]-=5;
	me3_row[0]=ship_row+rand()%5+1-7;
	if(me3_row[0]<=2) me3_row[0]+=5;
	char key;
	while(1){
		gotoxy(0,0);
		if(eship_row>ship_row){
			eship_row--;
			map[eship_row][eship_arr-1]=' '; 
		}
		if(eship_row<ship_row){
			eship_row++;
			map[eship_row-2][eship_arr-1]=' '; 
		}
		if(ship_exp>=(10+level*15)){
			ship_exp-=(10+level*15);
			level++;
			cout<<"已升级为"<<level<<"级";
		}
		system("title 星际迷途测试版v2.0");
		
		if(ship_hp<=0){
			system("cls");
			cout<<"you lose!!!";
			break;			
		}
		if(eship_hp<=0){
			system("cls");
			cout<<"you win!!!";
			break;
		}
		if(me_arr[met]<=2){
			map[me_row[met]-1][me_arr[met]-1]=' ';
			met++;
			me_row[met]=ship_row; 
		}
		if(me2_arr[met2]<=2){
			map[me2_row[met2]-1][me2_arr[met2]-1]=' ';
			met2++;
			me2_row[met2]=ship_row; 
			me2_row[met2]=ship_row+rand()%10+1-7;
			if(me2_row[met2]>=18) me2_row[met2]-=5;
		}
		if(me3_arr[met3]<=2){
			map[me3_row[met3]-1][me3_arr[met3]-1]=' ';
			met3++;
			me3_row[met3]=ship_row; 
			me3_row[0]=ship_row+rand()%5+1-7;
			if(me3_row[0]<=2) me3_row[0]+=5;
		}
		if(bul_arr<=2||bul_arr>=108){
			map[bul_row-1][bul_arr-1]=' ';
			bul_time=1;
		}
		if(bul2_arr<=2){
			map[bul2_row-1][bul2_arr-1]=' ';
			bul2_time=1;
		}
		map[ship_row-1][ship_arr-1]='>';
		map[eship_row-1][eship_arr-1]='<';
		map[me_row[met]-1][me_arr[met]-1]='#';
		map[me2_row[met2]-1][me2_arr[met2]-1]='#';
		map[me3_row[met3]-1][me3_arr[met3]-1]='#';
		map[exp_row[mete]-1][exp_arr[mete]-1]='*';
		if(bul_time==0){
			map[bul_row-1][bul_arr-1]='@'; 
		} 
		if(bul2_time==0){
			map[bul2_row-1][bul2_arr-1]='+'; 
		} 
		//输出地图	
		for(int i=0;i<20;i++){
			for(int j=0;j<110;j++){
				cout<<map[i][j];
			}
			cout<<endl;
		}
		cout<<"血量 : "<<ship_hp<<" 等级 : "<<level<<" "<<"exp : "<<ship_exp<<"/"<<10+15*level<<" "<<"敌方血量 :"<<eship_hp<<endl; 
		if(me_row[met]==ship_row&&me_arr[met]==ship_arr){			
			cout<<"飞船受到了攻击!";
			ship_hp-=30;
			map[me_row[met]-1][me_arr[met]-1]=' ';
			met++;
			me_row[met]=ship_row; 
		}
		if(me2_row[met2]==ship_row&&me2_arr[met2]==ship_arr){
			cout<<"飞船受到了攻击!";
			ship_hp-=30;
			map[me2_row[met2]-1][me2_arr[met2]-1]=' ';
			met2++;
			me2_row[met2]=ship_row; 
			me2_row[met2]=ship_row+rand()%10+1-7;
			if(me2_row[met2]<=2) me2_row[met2]+=5;
		}
		if(me3_row[met3]==ship_row&&me3_arr[met3]==ship_arr){
			cout<<"飞船受到了攻击!";
			ship_hp-=30;
			map[me3_row[met3]-1][me3_arr[met3]-1]=' ';
			met3++;
			me3_row[met3]=ship_row; 
		    me3_row[0]=ship_row+rand()%5+1-7;
			if(me3_row[0]<=2) me3_row[0]+=5;
		}
		if(exp_row[mete]==ship_row&&exp_arr[mete]==ship_arr){
			cout<<"飞船获得了资源!";
			ship_hp+=20;
			map[exp_row[mete]-1][exp_arr[mete]-1]=' ';
			mete++;
			exp_row[mete]=rand()%16+2;
			exp_arr[mete]=rand()%107+1;
			ship_exp+=20;
		}
		if(bul2_row==ship_row&&bul2_arr==ship_arr){			
			cout<<"飞船受到了攻击!";
			ship_hp-=70;
		    bul2_time=1;
		}
		if(bul_row==eship_row&&bul_arr==eship_arr){			
			cout<<"敌方飞船受到了攻击!";
			eship_hp-=30;
		    bul_time=1;
		}
		if(kbhit()){
			key=getch();
			if(key=='a'&&ship_arr!=2){
			ship_arr--;
			map[ship_row-1][ship_arr]=' ';
			}
			else if(key=='d'&&ship_arr!=109){
			ship_arr++;
			map[ship_row-1][ship_arr-2]=' ';
			}
			else if(key=='s'&&ship_row!=19){
			ship_row++;
			map[ship_row-2][ship_arr-1]=' ';
			}
			else if(key=='w'&&ship_row!=2){
			ship_row--;
			map[ship_row][ship_arr-1]=' ';
			}
			else if(key=='e'&&level>=3&&bul_time==1){
				bul_row=ship_row;
				bul_arr=ship_arr;
				bul_time=0;
			}
			else if(key==' '){
				system("pause");
			}
		}	
		if(bul2_time==1){
			bul2_row=eship_row;
			bul2_arr=eship_arr;
			bul2_time=0;
		}	
		Sleep(50);
		me_arr[met]--;
		map[me_row[met]-1][me_arr[met]]=' ';
		me2_arr[met2]--;
		map[me2_row[met2]-1][me2_arr[met2]]=' ';
		me3_arr[met3]--;
		map[me3_row[met3]-1][me3_arr[met3]]=' ';
		if(bul_time==0){
			bul_arr++;
			map[bul_row-1][bul_arr-2]=' ';
		}
		if(bul2_time==0){
			bul2_arr--;
			map[bul2_row-1][bul2_arr]=' ';
		}
	}
	return 0;
}//赞赞赞!!!点赞啊!!! d=====( ̄▽ ̄*)b 
10 个赞

内心OS:bug版好像好玩一些

2 个赞

有人吗????

2 个赞

有人

1 个赞

哦哦

2 个赞

好玩,赞了

为什么我的成了这样
image

1 个赞

你是什么系统??

window10
啊!
如果你们都没有问题
那应该就是我的问题吧!

这。。。?

你们想知道大多人做游戏的方式吗??(想听我发一期帖子)

你这游戏有问题啊
前面的提示完了之后就直接退出了

1 个赞

系统问题,win11玩不了

我的也是这样,应该是Win7

我就是win11

没有