C++自制游戏《袁坤》1.2版本发布!

大家好,我是派蒙,关于《袁坤》这个系列,我已经10天没有更新了(详见《c++自制游戏《袁坤》1.1版本发布啦!-CSDN博客》发布于2023年12月3日),那么下面就是源代码:

#include <iostream>
#include <bits/stdc++.h>
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <stdlib.h>
using namespace std;
string a;
int main(){
	int L=1,life=100,dlife=100,J=1,s=1000,sj=0,sh=50,lifej=0;
	int h416=0,ak74n=0,scar=0,aug=0,g18c=0,m1911=0;
	cout<<"========================================="<<endl<<endl;
	cout<<"                    袁坤"<<endl<<"                   1.2版本"<<endl;
	Sleep(2000);
	system("cls");
	
	cout<<"========================================="<<endl<<endl;
	cout<<"         抵制不良游戏,拒绝盗版游戏。"<<endl;
	cout<<"         注意自我保护,谨防受骗上当。"<<endl;
	cout<<"         适度游戏益脑,沉迷游戏伤身。"<<endl;
	cout<<"         合理安排时间,享受健康生活。"<<endl<<endl;
	cout<<"              初始化资源中..."<<endl;
	int n=20;
	cout<<"            _____________________"<<endl;
	cout<<"            ";
	while(n--){
		cout<<"█";
		Sleep(300);
	}
	system("cls");
//====================================================	 	
	cout<<"========================================="<<endl<<endl;
	cout<<"         抵制不良游戏,拒绝盗版游戏。"<<endl;
	cout<<"         注意自我保护,谨防受骗上当。"<<endl;
	cout<<"         适度游戏益脑,沉迷游戏伤身。"<<endl;
	cout<<"         合理安排时间,享受健康生活。"<<endl<<endl;
	cout<<"             加载客户端数据中..." <<endl;
	n=20;
	cout<<"            _____________________"<<endl;
	cout<<"            ";
	while(n--){
		cout<<"█";
		Sleep(300);
	}
	system("cls");
	cout<<"========================================="<<endl;
	cout<<"                   公告"<<endl;
	cout<<"    本游戏于12月10日更新后,有如下改动:"<<endl;
	cout<<"    1.昵称取消限制。"<<endl;
	cout<<"(按任意键继续)"<<endl;
	char x=getchar();
	system("cls"); 
//====================================================	 	
	cout<<"========================================="<<endl<<endl;
	cout<<"    欢迎来到坤瓦特大陆,rap者,请问你叫什"<<endl;
	cout<<"么名字?"<<endl;
	cout<<"请输入你的名字:"<<endl;
	cin>>a;
	cout<<"    "<<a;
	cout<<",这是你的坤瓦特通行证,"<<endl;
	cout<<"有了它,你就能通行坤瓦特大部分地区了。"<<endl;
	Sleep(2000);
	 system("cls");
//====================================================	
	
	while(1){
		cout<<"========================================="<<endl;
		cout<<"    "<<a;
		cout<<"        等级:"<<L<<"  财产:"<<s<<endl; 
		cout<<"选择要做的事情:(输入对应的序号)"<<endl;
		cout<<"A.移动  B.购买  C.出售  D.查看物品 E.探索"<<endl;
		cout<<"F.关于  G.退出"<<endl;
		if(sj!=0){
			cout<<"H.手机"; 
		}
		x=getchar();
		system("cls");
		life=100+lifej;
		dlife=100+L*5;
		if(x=='A'){//移动 
			system("cls");
			cout<<"========================================="<<endl;
			cout<<"选择要去的地方:"<<endl;
			cout<<"A.饭店  B.手机店  C.野外  D.家"<<endl;
			cin>>x;
			system("cls");
			if(x=='A'){//饭店 
				system("cls");
				cout<<"========================================="<<endl;
				cout<<"饭店正在装修,敬请期待。"<<endl;
				Sleep(1000); 
				system("cls");
			} else if(x=='B'){//手机店 
				cout<<"========================================="<<endl;
				cout<<"请问您要买什么手机?"<<endl;
				cout<<"A.小米($1000)  B.苹果($1500)"<<endl;
				cout<<"C.华为($1550)  D.离开"<<endl;
				cin>>x; 
				if(x=='A'){//小米 
					if(s>=1000){
						cout<<"恭喜您喜提新机!"<<endl; 
						sj=1;
					}else{
						cout<<"余额不足!"<<endl;
					}
				} 
				if(x=='B'){//苹果 
					if(s>=1500){
						cout<<"恭喜您喜提新机!"<<endl;
						sj=2; 
					}else{
						cout<<"余额不足!"<<endl;
					}
				} 
				if(x=='C'){//华为 
					if(s>=1550){
						cout<<"恭喜您喜提新机!"<<endl; 
						sj=3;
					}else{
						cout<<"余额不足!"<<endl;
					}
				} 
				Sleep(1000); 
				system("cls");
			}else if(x=='C'){//野外
				system("cls");
				cout<<"========================================="<<endl;
				cout<<"一只野生坤坤向你扑了过来!"<<endl;
				while(dlife>0){
					if(life<=0){
						cout<<"你死了!!!"<<endl;
						cout<<"You died!"<<endl;
						Sleep(3000);
						system("cls");
						cout<<"========================================="<<endl;
						cout<<"              rap者信息:"<<endl;
						cout<<"名字:"<<a<<"等级:"<<L<<"财产:"<<s<<endl;
						cout<<"            死于与坤坤的战斗"<<endl;
						cout<<"按任意键结束"<<endl;
						cin>>x;
						return 0; 
					}
					if(dlife>0){
						cout<<"坤坤攻击,你的血量-10。"<<endl;
						life-=10; 
					}
					if(life>0){
						cout<<"你反击,坤坤血量-"<<sh<<"。"<<endl;
						dlife-=sh;	
					}
					if(dlife<=0){
						cout<<"坤坤被击败,你的等级+2,财产+100。"<<endl;
						L+=2;
						s+=100; 
						Sleep(2000);
						break;
					}
				}
			}else if(x=='D'){//家 
			cout<<"========================================="<<endl;
				cout<<"请选择要做的事情:"<<endl;
				cout<<"A.吃饭  B.睡觉"<<endl;
				cin>>x;
				if(x=='A'){
					Sleep(3000);
					cout<<"吃完了"<<endl; 
				} else if(x=='B'){
					Sleep(5000);
					cout<<"睡醒了"<<endl; 
				}
				Sleep(1000); 
				system("cls");
			}
		}else if(x=='B'){//购买 
				system("cls");
				cout<<"========================================="<<endl;
				cout<<"要买什么?"<<endl;
				cout<<"步枪"<<endl;
				cout<<"       ▃▃"<<endl;
				cout<<"==-===▅==▅==▌"<<endl;
				cout<<"      █ *▋  ▍"<<endl;
				cout<<"A.H416  B.AK74N  C.SCAR  D.AUG"<<endl;
				cout<<"($3000) ($2000)  ($2500) ($3000)"<<endl;
				cout<<"手枪"<<endl;
				cout<<"=-▅▅▅"<<endl;
				cout<<"    *▌"<<endl;
				cout<<"E.G18c  F.M1911"<<endl;
				cout<<"($1500) ($1000)"<<endl;
				cout<<"防弹衣"<<endl;
				cout<<"G.标准安保防弹衣(防弹等级:1)"<<endl;
				cout<<"($500)"<<endl;
				cout<<"H.特勤防弹衣(防弹等级:2)"<<endl;
				cout<<"($1000)"<<endl;
				cout<<"I.战术防弹衣(防弹等级:3)"<<endl;
				cout<<"($1500)"<<endl;
				cout<<"J.高级防弹衣(防弹等级:4)"<<endl;
				cout<<"($2000)"<<endl;
				cin>>x;
				if(x=='A'){
					cout<<"购买成功!";
					h416++;
					s-=3000;
				} 
				if(x=='B'){
					cout<<"购买成功!";
					ak74n++;
					s-=2000;
				} 
				if(x=='C'){
					cout<<"购买成功!";
					scar++;
					s-=2500;
				} 
				if(x=='D'){
					cout<<"购买成功!";
					aug++;
					s-=3000;
				} 
				if(x=='E'){
					cout<<"购买成功!";
					g18c++;
					s-=1500;
				} 
				if(x=='F'){
					cout<<"购买成功!";
					m1911++;
					s-=1000;
				}  
				if(x=='G'){
					cout<<"购买成功!";
					s-=500;
					lifej=20;
				}  
				if(x=='H'){
					cout<<"购买成功!";
					s-=1000;
					lifej=40;
				}  
				if(x=='I'){
					cout<<"购买成功!";
					s-=1500;
					lifej=60;
				}  
				if(x=='J'){
					cout<<"购买成功!";
					s-=2000;
					lifej=80;
				} 
			Sleep(1000); 
				system("cls");
		}else if(x=='C'){
			system("cls");
			cout<<"========================================="<<endl;
			cout<<"此功能正在开发中,敬请期待。"<<endl; Sleep(1000); 
			system("cls");
		} else if(x=='D'){
			system("cls");
			cout<<"========================================="<<endl;
			cout<<"武器:"<<endl;
			cout<<"A.H416:"<<h416<<" B.AK74N:"<<ak74n<<" C.SCAR:"<<scar<<" D.AUG:"<<aug<<endl;
			cout<<"E.G18c:"<<g18c<<" F.M1911:"<<m1911<<"G.退出"<<endl;
			cout<<"(防弹衣以最后购买为准)" <<endl;
			cin>>x;
			if(x=='A'){
				if(h416>0){
					cout<<"装备成功!"<<endl;
					sh=80; 	
				}else{
					cout<<"该武器未拥有!!!"<<endl;
				}
				
			}else if(x=='B'){
				if(ak74n>0){
					cout<<"装备成功!"<<endl;
					sh=85; 	
				}else{
					cout<<"该武器未拥有!!!"<<endl;
				}
			}else if(x=='C'){
				if(scar>0){
					cout<<"装备成功!"<<endl;
					sh=79; 	
				}else{
					cout<<"该武器未拥有!!!"<<endl;
				}
			}else if(x=='D'){
				if(aug>0){
					cout<<"装备成功!"<<endl;
					sh=80; 	
				}else{
					cout<<"该武器未拥有!!!"<<endl;
				}
			}else if(x=='E'){
				if(g18c>0){
					cout<<"装备成功!"<<endl;
					sh=60; 	
				}else{
					cout<<"该武器未拥有!!!"<<endl;
				}
			}else if(x=='F'){
				if(m1911>0){
					cout<<"装备成功!"<<endl;
					sh=59; 	
				}else{
					cout<<"该武器未拥有!!!"<<endl;
				}
			}
			Sleep(1000); 
				system("cls"); 
		}else if(x=='F'){
				system("cls");
			cout<<"========================================="<<endl<<endl;
			cout<<"    关于此游戏:"<<endl;
			cout<<"    《袁坤》是一款由原神启动(袁*杰)制作"<<endl; 
			cout<<"的C++小游戏,在游戏中,玩家将扮演一名rap"<<endl;
			cout<<"者,探索坤瓦特大陆。"<<endl;
			cout<<"                     更新于2023年11月26日"<<endl<<endl;
			cout<<"(按任意键继续)"<<endl;
			cin>>x; 
				system("cls");
		} else if(x=='E'){
				system("cls");
				cout<<"========================================="<<endl;
			cout<<"此功能正在开发中,敬请期待。"<<endl; Sleep(1000); 
				system("cls");
		}else if(x=='G'){
			cout<<"========================================="<<endl<<endl<<endl<<endl;
			cout<<"                正在退出..."<<endl;
			 int n=20;
			cout<<"          _____________________"<<endl;
			cout<<"          ";
			while(n--){
			cout<<"█";
			Sleep(300);
			}
			return 0;	
		} else if(sj!=0&&x=='H'){
			if(sj==3){
				cout<<"┍-----------------┑"<<endl;
				cout<<" | 12:00          |"<<endl;
				cout<<" |   ┎┒① ┎┒      |"<<endl;
				cout<<" |   ┖┚   ┖┚      |"<<endl;
				cout<<" |   邮件应用     |"<<endl;
				cout<<" |       商城     |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<"┖-----------------┚"<<endl;
				cout<<"按1打开邮件,按2关闭手机。"<<endl;
				cin>>x;
				if(x=='1'){
				cout<<"┍-----------------┑"<<endl;
				cout<<" | 12:00           |"<<endl;
				cout<<" |-----------------|"<<endl;
				cout<<" |华为官方    9:00 |"<<endl;
				cout<<" |亲爱的用户...... |"<<endl;
				cout<<" |        (按1打开)|"<<endl;
				cout<<" |-----------------|"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" | 没有其他消息了。|"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<"┖-----------------┚"<<endl;
				cin>>x;
				if(x=='1'){
				cout<<"┍-----------------┑"<<endl;
				cout<<" | 12:00           |"<<endl;
				cout<<" |-----------------|"<<endl;
				cout<<" |华为官方    9:00 |"<<endl;
				cout<<" |亲爱的用户,您好! |"<<endl;
				cout<<" |欢迎购买本手机, |"<<endl;
				cout<<" |这是一份无限的钱 |"<<endl;
				cout<<" |财,请笑纳!      |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |-----------------|"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |财产*1000        |"<<endl;
				cout<<" |      (按1领取)  |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<"┖-----------------┚"<<endl;
				cin>>x;
				if(x=='1'){
					s+=1000;
					system("cls");
				} 
				}
				}
				if(x=='2'){
					system("cls");
				} 
			}
			if(sj==2){ 
				cout<<"╭-----------------╮"<<endl;
				cout<<" | 12:00           |"<<endl;
				cout<<" |   ┎┒  ┎┒      |"<<endl;
				cout<<" |   ┖┚  ┖┚      |"<<endl;
				cout<<" |   邮件应用      |"<<endl;
				cout<<" |       商城      |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<" |                 |"<<endl;
				cout<<"├-----------------┤"<<endl;
				cout<<" |        ○         |"<<endl;
				cout<<"╰-----------------╯"<<endl;
				cout<<"按任意键继续"<<endl;
				cin>>x;
				system("cls");
			}
			if(sj==1){
				cout<<"┍-----------------┑"<<endl;
				cout<<" | 12:00          |"<<endl;
				cout<<" |   ┎┒  ┎┒       |"<<endl;
				cout<<" |   ┖┚  ┖┚       |"<<endl;
				cout<<" |   邮件应用     |"<<endl;
				cout<<" |       商城     |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" |                |"<<endl;
				cout<<" | △    ○    □ |"<<endl;
				cout<<"┖-----------------┚"<<endl;
				cout<<"按任意键继续"<<endl;
				cin>>x;
				system("cls");
			}
		}
	}	
}

------------------------------------------------------------------

(转载请标明原作者)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值