c++游戏-掠梦者

本文介绍了名为猎梦者的游戏小程序,其代码中包含了床、门和炮台的升级功能,以及玩家与猎梦者战斗的过程。通过控制台输入选择升级或挑战,游戏逻辑清晰,展示了基础的编程技能。
摘要由CSDN通过智能技术生成

月光轻轻把梦勾走,是猎梦者的杰作

猎梦者初期版本,代码如下:

#include<iostream>
#include<ctime>
#include<cstdlib>
#include<windows.h>
#include<stdlib.h>
using namespace std;
int main(){
	long long a,b=10,c=1,d=1,e=1,ee,eee=20,f=0,g,h=100,hh=100,hhh=0,i=0,r=1,bbbb,ttt;
	for(b=10;r==1&&hhh==0;i=i-0){//r是生命值,hhh是猎梦者的血量 
	cout<<"1:升级床,2:升级门,3:升级炮台,4:增加炮台,5:发起挑战,6:睡觉,7:查看;"<<endl;
	cin>>a;
	g=20;
	switch (a) {
		case 1:
	if(b>=30){
	b=b-30;//总财产 
	c=c+1;//床的等级 
	cout<<"升级成功!"<<endl;	//TODO
	}else{
	cout<<"金币不足!"<<endl;	//TODO
	}		//TODO
			break;
		case 2:
	if(b>=30){
	b=b-30;
	d=d+1;
	h=h*d;
	cout<<"升级成功!"<<endl;	//TODO
	}else{
	cout<<"金币不足!"<<endl;	//TODO
	}		//TODO
			break;
		default://当时还不会 
    switch (a) {
		case 3:
	if(b>=50){
	cout<<"升级成功!"<<endl;	//TODO
	ee=ee+1;
	eee=ee*e;
	}else{
	cout<<"金币不足!"<<endl;	//TODO
	}			//TODO
			break;
		case 4:
	if(b>=50){
	cout<<"增加成功!"<<endl;	//TODO
	e=e+1;
	eee=e*ee;
	}else{
	cout<<"金币不足!"<<endl;	//TODO
	}			//TODO
	break;
	default:
	switch (a) {
	case 5:
	if(c>=5){
	f=f+g;
	hh=hh+g;
	cout<<"猎梦者";
	Sleep(1000);
	cout<<"即将出现!"<<endl;
	for(r=1;hh>0;hh=hh+5){
	Sleep(100);
	cout<<"_"<<'\n';
	cout<<">>(O)"<<'\n';
	cout<<"—"<<"\n";
	Sleep(300);
	system("cls");
	cout<<"              _"<<'\n';
	cout<<"              >>(O)"<<'\n';
	cout<<"              —"<<'\n';
	Sleep(300);
	system("cls");
	cout<<"              		_"<<'\n';
	cout<<"              		>>(O)"<<'\n';
	cout<<"              		—"<<'\n';
	Sleep(300);
	system("cls");
	cout<<"              				_"<<'\n';
	cout<<"              				>>(O)"<<'\n';
	cout<<"              				—"<<'\n';
	cout<<"发射炮弹!";
	hh=hh-eee;
	h=h-f;	//TODO
	cout<<"大门血量还剩"<<h<<endl;
	cout<<"猎梦者血量还剩"<<hh<<endl;
	cout<<"攻击力:"<<eee<<endl;	//TODO
	Sleep(300);
	if(hh<=0||h<=0){
	if(hh<=0){
	cout<<"猎梦者失败!";
	hhh=1;
	Sleep(1000);
	break;	//TODO
	}else{
	cout<<"你死了!";
	r=0;
	Sleep(3000);
	break;	//TODO
	}	//TODO
	}
	}
		//TODO
	}else{
	cout<<"等级不足!"<<endl;
	cout<<"提升至5级可发起挑战!"<<endl;	//TODO
	}	
	//TODO
	break;
	case 6:
	cout<<"请输入睡觉时长"<<endl; 
	cin>>bbbb;
	for(int ttt=0;bbbb>=ttt;ttt++){
	cout<<"+"<<c<<"金币"<<endl;//TODO
	b=b+c;
	Sleep(500);
	system("cls");
	Sleep(500);			//TODO
	}
	ttt=0;
	break;
	default:
	//TODO
	break;
	}
		//TODO
			break;
	}		//TODO
			break;
	}
	Sleep(100);
	system("cls");
		//TODO
	}
	if(r==1){
	cout<<"恭喜您成功通关"<<endl;	//TODO
	}else{
	cout<<"不要气馁再来一次"<<endl;	//TODO
	}
	cout<<"别走,后面有彩蛋!"<<endl;
	Sleep(10000);          				
	cout<<"		                   .-        -.	"<<'\n';
	cout<<"    			          /            \ "<<'\n';
	cout<<"		                 |              |"<<'\n';
	cout<<"    			         |,  .-.  .-.  ,|"<<'\n';
	cout<<"		                 | )(__/  \__)( |"<<'\n';
	cout<<"		                 |/     /\     \|"<<'\n';
	cout<<"		       (@_       (_     ^^     _)"<<'\n';
	cout<<"		  _     ) \_______\__|IIIIII|__/__________________________"<<'\n';
	cout<<"		 (_)@8@8{}<________|-\IIIIII/-|___________________________>"<<'\n';
	cout<<"		        )_/        \          /"<<'\n';
	cout<<"		(@           `--------`"<<'\n';
	system("color 0A");
	Sleep(100);
	system("color 1B");
	Sleep(100);
	system("color 2C");
	Sleep(100);
	system("color 3D");
	Sleep(100);
	system("color 4E");
	Sleep(100);
	system("color 5F");
	Sleep(100);
	system("color 6A");
	Sleep(100);
	system("color 7B");
	Sleep(100);
	system("color 8C");
	Sleep(100);
	system("color 9D");
	Sleep(100);
	system("color 0E");
	Sleep(200);
	cout<<"Σσ(·Д·;)我我我什么都没做!!!"<<endl;
	Sleep(500);
	cout<<"骗你的!";
	return 0;	
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值