栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

自从玩了我自己创造的这个c++游戏后,总感觉一分钟好长(火龙征战V1.0.1)

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

自从玩了我自己创造的这个c++游戏后,总感觉一分钟好长(火龙征战V1.0.1)

大家好,我是大白,我又来说之前我的那个游戏了!!!

这次是V1.0.1版,但是其实没有更新多少,具体的去公告看。

为什么说一分钟变长呢?请看下面的图片

 这个游戏的标题啊,我刚开始没取好,所以程序名就叫“自己的打怪兽了”

每次到了钓鱼的时候,都要等好久,我有时尿泡尿会来,他还在钓鱼

我的游戏还支持存档

妈妈再也不用担心游戏打到一半就又要重来了

推荐在存档前先创建一个名叫存档.txt的文件!!! 

好的,看代码:

#include
#include 
using namespace std;
int zhangjie=0;
long long yuanatk=10,yuandef=10,HP=100,money=0,maxHP=100;
long long wuqiatk=0,kuijiadef=0;
long long atk=yuanatk+wuqiatk,def=yuandef+kuijiadef;
bool dun=false;
bool kuijia=false;
bool huifu=false;
int liliang=0,wudi=0,xuebao=0; 
int bag=0;
int lv=0;
int exp_=0;
int xiaoguaiexp=0;
int daguaiexp=0;
int xiaoguailv=1;
int daguailv=1;
int shaguaishu=0;
string name; 

void init(){
	zhangjie=0;
	yuanatk=10,yuandef=10,HP=100,money=0,maxHP=100;
	wuqiatk=0,kuijiadef=0;
	atk=yuanatk+wuqiatk,def=yuandef+kuijiadef;
	dun=false;
	kuijia=false;
	huifu=false;
	liliang=0,wudi=0,xuebao=0; 
    bag=0;
    lv=0;
 	exp_=0;
	xiaoguaiexp=0;
	daguaiexp=0;
	xiaoguailv=1;
	daguailv=1;
	shaguaishu=0;
	name=" "; 
}
int lvexp[10005]={0,   2,   3,   5 ,  7,   11,  13,  17,  19,  23,  
				  29,  31,  37,  41,  43,  47,  53,  59,  61,  67,
				  71,  73,  79,  83,  89,  97,  101, 103, 107, 109,
				  113, 127, 137, 139, 149, 151, 157, 163, 167, 173,
				  179, 181, 193, 197, 199, 211, 223, 227, 229, 233,
				  239, 241, 251, 257, 263, 269, 271, 277, 281, 283,
				  293, 307, 311, 313, 317, 331, 337, 347, 349, 353,
				  359, 367, 373, 379, 383, 389, 397, 401, 409, 419,
				  421, 431, 433, 439, 443, 449, 457, 461, 463, 467,
				  479, 487, 491, 499, 503, 509, 521, 523, 541, 547,
				  557, 563, 569, 571, 577, 587, 593, 599, 601, 607,
			   	  613, 617, 619, 631, 641, 643, 647, 653, 659, 661,
			      673, 677, 683, 691, 701, 709, 719, 727, 733, 739,
			      743, 751, 757, 761, 769, 773, 787, 797, 809, 811,
			      821, 823, 827, 829, 839, 853, 857, 859, 863, 877,
			      881, 883, 887, 907, 911, 919, 929, 937, 941, 947,2147483647};
void cls(){//清屏 
	system("cls");
	return;
}
void con(){//按任意键继续 
    system("pause");
    cls();
}
void kaishi(){
	cout<<"很久很久以前n";
	cout<<"地球上生活着人类和怪物..."<>name; 
	cls();
	return;
}
void lvup(bool a){
	while(exp_>=lvexp[lv+1]){
		exp_-=lvexp[lv+1];
		lv+=1;
		yuanatk+=3*lv;
		yuandef+=3*lv;
		maxHP+=20;
		HP=maxHP; 
		if(a){
			cout<<"你升级了!!升级了!!升级!!哦哦哦!!!"<=lvexp[xiaoguailv]){
		xiaoguaiexp-=lvexp[xiaoguailv];
		xiaoguailv+=1;
	}
	return;
}
void dalvup(){
	if(daguaiexp>=lvexp[daguailv]){
		daguaiexp-=lvexp[daguailv];
		daguailv+=1;
	}
	return;
}
void shop(){//商店功能 
	char a;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN );
	cout<<"老板:小兄弟,你来这里购买?太好了!"<>a;
	cls();
	switch(a){
		case '1':
			if(money>=40){
				money-=40;
				wuqiatk=50;
				atk=yuanatk+wuqiatk;
				cout<<"谢谢惠顾!"<=800){
				money-=800;
				wuqiatk=800;
				atk=yuanatk+wuqiatk;
				cout<<"谢谢惠顾!"<=15000){
				money-=15000;
				wuqiatk=60000;
				atk=yuanatk+wuqiatk;
				cout<<"谢谢惠顾!"<=80){
					money-=80;
					def+=40 ;
					cout<<"谢谢惠顾!"<=2000){
					money-=2000;
					kuijiadef+=300; 
					cout<<"谢谢惠顾!"<=1200){
				if(bag==8){
					cout<<"包满啦"<=700){
				if(bag==8){
					cout<<"包满啦"<=400){
				if(bag==8){
					cout<<"包满啦"<=5000){
					money-=5000;
					kuijiadef+=300; 
					cout<<"谢谢惠顾!"<=123456){
				money-=123456;
				atk=2147483647;
				cout<<"谢谢惠顾!"<>a;
	switch(a){
		case 1:
			cout<<"你感觉充满了力量!"<0&&guaiHP>0){
		if(b){
			b-=1;
			if(!b){
				atk_-=4000;
			}
		}
		cout<<"你碰到了"<>a;
		cls();
		switch(a){
			case 1:
				srand(time(0));
				if(rand()%max(2,(xiaoguailv-lv+2))==0){
					cout<<"你攻击了,但小怪躲开了"<0&&guaiHP>0){
		if(b){
			b-=1;
			if(!b){
				atk_-=4000;
			}
		}
		cout<<"你碰到了"<>a;
		cls();
		switch(a){
			case 1:
				srand(time(0));
				if(rand()%max(2,(daguailv-lv+2))==0){
					cout<<"你攻击了,但大怪躲开了"<maxHP)HP=maxHP;
		}
		con();
	}
	if(HP<=0)die();
	if(run)return;
	if(guaiHP<=0){
		cout<<"你胜利了!"<0&&bossHP>0){
		if(def_){
			def_=false;
			bossatk+=def;
		}
		if(b){
			b-=1;
			if(!b){
				atk_-=4000;
			}
		}
		cout<<"你的回合!!!" <>a;
		cls();
		switch(a){
			case 1:
				srand(time(0));
				if(rand()%max(2,(35-lv+2))==0){
					cout<<"你攻击了,但boss躲开了"<maxHP)HP=maxHP;
		}
		con();
	}
	if(HP<=0)die();
	if(run)return;
	if(bossHP<=0){
		cout<<"你胜利了...但你并不开心"<>a;
	switch(a){
		case 1:
			cout<<"盖房子需要20s,获得1~10@";
			Sleep(20000);
			cls();
			srand(time(0));
			b=(rand()%10==0?10:rand()%10);
			cout<<"你获得了"<3){//埋下伏笔 
	}
	else{
		cout<<"还没到呢,后面再说";
		Sleep(3000); 
		cls(); 
	}
	return;
}
void write_file(){
	ofstream fout("存档.txt");
	fout<>a;
	if(a=='y'){
		cout<<"正在重置存档,存档后请重进游戏...";
		init(); 
		write_file();
		Sleep(5000);
		cout<<"成功!";
		con(); 
		return; 
	} 
	else{
		cls();
		return;
	}
}
void gonggao(){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY |FOREGROUND_GREEN );
	cout<<"火龙征程V1.0.1"<>a;
		switch(a){
			case 1:
				cls();
				xiaoguai();
				break;
			case 2:
				cls();
				daguai();
				break;
			case 3:
				cls();
				shop();
				break;
			case 4:
				cls();
				dagong();
				break;
			case 5:
				cls();
				yuanzheng();
				break;
			case 6:
				cls();
				zhuangtai();
				break; 
			case 7:
				cls();
				write_file();
				break;
			case 8:
				cls();
				chongzhicundang();
				break;
			case 9:
				cls();
				gonggao(); 
				break;
			default:
				cout<<"退退退!别乱点!"<>name;
	fin>>zhangjie;
	fin.close();
	if(zhangjie==0){
		init();
		juqing();
	}
	else{
		ifstream fin("存档.txt");
		fin>>name;
		fin>>zhangjie;
		fin>>money;
		fin>>exp_;
		fin>>lv;
		fin>>HP;
		fin>>yuanatk;
		fin>>wuqiatk;
		fin>>yuandef;
		fin>>kuijiadef;
		fin>>liliang;
		fin>>wudi;
		fin>>xuebao;
		fin>>dun;
		fin>>kuijia;
		fin>>huifu;
		fin>>bag;
		fin>>xiaoguaiexp;
		fin>>daguaiexp;
		fin>>xiaoguailv;
		fin>>daguailv;
		fin>>shaguaishu;
		fin>>maxHP;
		fin.close();
		mianban();
	}
}


int main(){
	read_file(); 
} 

还有,如有bug和建议,请在评论区指出

求关注

我是大白,下次再见

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1001529.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号