我呢之前做了一个游戏,那还没做好,我发一个一样还没做好的小游戏
喜欢看起来比较完整地朋友可以去自制小游戏复制。
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int hyy=0;
void yc()
{
HWND hwnd;
hwnd=FindWindow("ConsoleWindowClass",NULL);
if(hwnd)
{
ShowWindow(hwnd,SW_HIDE);
}
}
void rq()
{
yc();
if (MessageBox(NULL,("你是傻子吗?"),("自暴自弃"),MB_ICONERROR|MB_YESNOCANCEL) == IDYES)
{
MessageBox(GetForegroundWindow(),"还真自暴自弃","无语",0);
}
else
{
while (MessageBox(NULL,("你咋又换了说法"),("你是谁??"),MB_ICONERROR|MB_YESNOCANCEL) != IDYES)
cout<<"sb";
MessageBox(GetForegroundWindow(),"被气死了吧!!!","哈哈哈",0);
return;
}
}
void logo(string a,string b,string c,int te=10){
cout<<a;
Sleep(te*10);
cout<<b;
Sleep(te*10);
cout<<c;
}
void cmh(){
cout<<" 陈陈陈 明 明 明明 瀚 \n";
cout<<" 陈 明明 明 明 瀚 瀚 \n";
cout<<" 陈 明 明 明 瀚瀚 瀚\n";
cout<<" 陈 明 明 明 瀚 瀚\n";
cout<<" 陈陈陈 明 明 明 瀚 瀚\n";
logo(" 陈"," 明","",10);logo(" 瀚"," 出"," 品\n",10);
Sleep(500);
cout<<"";
logo(" 必"," 是","",10);logo(" 精"," 品"," \n",10);
getchar();
Sleep(100);
system("cls");
}
int main()
{
srand(time(0));
cmh();
cout<<"室外温度℃:";
int t;
cin>>t;
getchar();
if(t<=-22){
cout<<"人体进入深度休眠";
}else if(t<22){
cout<<"多穿衣服";
}else if(t<35){
cout<<"正常穿衣";
}else if(t<48){
cout<<"少穿衣服";
}else if(t<500){
cout<<"人煮熟了";
}else if(t==666){
cout<<"你好像发现了什么\n你要继续吗?(Y是.N不是):";
string ch,name;
cin>>ch;
getchar();
if(ch=="Y"){
system("cls");
Sleep(500);
cout<<"你穿越到了一个有怪兽存在的世界\n";
Sleep(500);
cout<<"不出意外的话马上就出意外了,你掉下悬崖了,但没死,还有了系统\n开始吧,马牛逼";
Sleep(500);
getchar();
system("cls");
cout<<"输入你的名字:";
cin>>name;
getchar();
Sleep(500) ;
system("cls");
long long xue=100,gongji=50,jingyan=0,dengji=1,xuesx=100,shenjixy=100,qian=100;
if(name=="cmh"||name=="陈明瀚"){
cout<<"开发者?开发者3问开始\n";
cout<<"开发者1问,开发者洛谷账号:";
cin>>ch;
getchar();
if(ch=="chenminghan"){
cout<<"正确\n开发者2问,开发者一本通账号:";
cin>>ch;
getchar();
if(ch=="13696934346"){
cout<<"正确\n开发者3问,开发者CSDN账号:";
cin>>ch;
getchar();
if(ch=="cmh20120102"){
cout<<"正确,开启开发者模式,血上线+999900,经验+10W";
xuesx+=999900;
xue=xuesx;
jingyan+=100000;
gongji=500000;
while(jingyan>shenjixy){
jingyan-=shenjixy;
dengji++;
shenjixy*=2;
}
Sleep(1000);
system("cls");
}
}
}
}
if(name=="SB"||name=="sb"||name=="2B"||name=="2b"||name=="大SB"||name=="大sb"||name=="傻逼"||name=="煞笔"){
cout<<"解锁成就:自暴自弃";
getchar();
rq();
return 0;
}
cout<<name<<",多么帅气的名字,开始吧!";
getchar();
system("cls");
int a;
while(1){
cout<<" 菜 单 选 项\n----------------------------------------\n1.打怪\n2.商店\n3.查看\n4.保存/读取\n5.退出\n----------------------------------------\n";
cin>>a;
getchar();
system("cls");
if(a==1){
do{
cout<<"小怪\n1 史莱姆(攻击20,血量100)\n2 1-5级三眼野猫(攻击40-200,血50-250)\n3黑.天使(攻击100,血1500)\n";
cout<<"中怪\n4 黑.六翼天使(攻击1000,血15000)\n5 东海青龙(攻击5000,血30000)\n6 哥斯拉(攻击10000,血1000)\n";
cout<<"大怪\n7 黑洞哥斯拉(攻击1000000,血15000000)8 \n10级十眼神猫(攻击2000000,血30000000)\n";
cout<<"神怪\n9 金角巨兽(在吞噬星空中不小心打破次元壁过来的..... 攻击100000000000,血1000000000000)\n";
cout<<"???\n10 斗战胜佛(攻击???,血???)\n";
cout<<"离谱怪\n11 灵萌(攻击0,血1)\n12 红用一(攻击10000000000,血1000000000000)";
cout<<"0 退出\n";
cin>>a;
getchar();
int n=1,gsx,gsg;
system("cls");
if(a==1){
gsx=100;
gsg=20;
while(gsx>0&&xue>0){
cout<<"第"<<n<<"回合";
gsx-=gongji;
xue-=gsg;
cout<<"史莱姆受到"<<gongji<<"点伤害,剩下"<<gsx<<"滴血\n";
Sleep(500);
cout<<name<<"受到"<<gsg<<"点伤害,剩下"<<xue<<"滴血\n";
Sleep(500);
n++;
}
if(xue<=0&&gsx<=0){
cout<<"你和史莱姆都死了";
return 0;
}else if(xue>0&&gsx<=0){
cout<<"你赢了,经验++,血上线++,钱++";
jingyan+=100;
xuesx+=50;
qian+=100;
gongji+=25;
while(jingyan>shenjixy){
jingyan-=shenjixy;
dengji++;
shenjixy*=2;
}
getchar();
system("cls");
}else{
cout<<"你死了";
return 0;
}
}else if(a==2){
int j=rand()%5+1;
cout<<"你抽到了"<<j<<"级三眼野猫\n";
gsx=j*50;
gsg=j*40;
while(gsx>0&&xue>0){
cout<<"第"<<n<<"回合";
gsx-=gongji;
xue-=gsg;
cout<<"三眼野猫受到"<<gongji<<"点伤害,剩下"<<gsx<<"滴血\n";
Sleep(500);
cout<<name<<"受到"<<gsg<<"点伤害,剩下"<<xue<<"滴血\n";
Sleep(500);
n++;
}
if(xue<=0&&gsx<=0){
cout<<"你和三眼野猫都死了";
return 0;
}else if(xue>0&&gsx<=0){
cout<<"你赢了,经验++,血上线++,钱++";
jingyan+=100;
xuesx+=50;
qian+=150;
gongji+=25;
while(jingyan>shenjixy){
jingyan-=shenjixy;
dengji++;
shenjixy*=2;
}
getchar();
system("cls");
}else{
cout<<"你死了";
return 0;
}
}else if(a==3){
gsx=100;
gsg=1500;
int temp=0;
while(gsx>0&&xue>0){
cout<<"第"<<n<<"回合";
int sj=rand()%4+1;
if(sj==1&&temp==0){
cout<<"天使飞上了天,双方都没扣血\n";
temp=1;
}else if(sj==2&&temp==1){
temp=3;
cout<<"天使飞了下来,你弄伤了它的翅膀\n";
gsx-=100;
xue-=gsg;
cout<<"天使受到"<<100<<"点伤害,剩下"<<gsx<<"滴血\n";
Sleep(500);
cout<<name<<"受到"<<gsg<<"点伤害,剩下"<<xue<<"滴血\n";
Sleep(500);
}else{
temp=0;
cout<<"天使飞了下来\n";
gsx-=gongji;
xue-=gsg;
cout<<"天使受到"<<gongji<<"点伤害,剩下"<<gsx<<"滴血\n";
Sleep(500);
cout<<name<<"受到"<<gsg<<"点伤害,剩下"<<xue<<"滴血\n";
Sleep(500);
}
n++;
}
if(xue<=0&&gsx<=0){
cout<<"你和天使都死了";
return 0;
}else if(xue>0&&gsx<=0){
cout<<"你赢了,经验++,血上线++,钱++";
jingyan+=100;
xuesx+=50;
qian+=100;
gongji+=25;
while(jingyan>shenjixy){
jingyan-=shenjixy;
dengji++;
shenjixy*=2;
}
getchar();
system("cls");
}else{
cout<<"你死了";
return 0;
}
}else if(a==4){
gsx=1000;
gsg=15000;
int temp=0;
while(gsx>0&&xue>0){
cout<<"第"<<n<<"回合";
int sj=rand()%4+1;
if(sj==1&&temp==0){
cout<<"六翼天使飞上了天给了你一个大逼兜\n";
xue--;
cout<<name<<"受到1点伤害,剩下"<<xue<<"滴血\n";
temp=1;
}else if(sj==2&&temp==1){
temp=3;
cout<<"六翼飞了下来,你弄伤了它的翅膀\n";
gsx-=100;
xue-=gsg;
cout<<"六翼受到"<<100<<"点伤害,剩下"<<gsx<<"滴血\n";
Sleep(500);
cout<<name<<"受到"<<gsg<<"点伤害,剩下"<<xue<<"滴血\n";
Sleep(500);
}else{
temp=0;
cout<<"六翼天使飞了下来\n";
gsx-=gongji;
xue-=gsg;
cout<<"六翼天使受到"<<gongji<<"点伤害,剩下"<<gsx<<"滴血\n";
Sleep(500);
cout<<name<<"受到"<<gsg<<"点伤害,剩下"<<xue<<"滴血\n";
Sleep(500);
}
if(xue<=0&&gsx<=0){
cout<<"你和六翼天使都死了";
return 0;
}else if(xue>0&&gsx<=0){
cout<<"你赢了,经验++,血上线++,钱++";
jingyan+=100;
xuesx+=50;
qian+=100;
gongji+=25;
while(jingyan>shenjixy){
jingyan-=shenjixy;
dengji++;
shenjixy*=2;
}
getchar();
system("cls");
}else{
cout<<"你死了";
return 0;
}
n++;
}
}else if(a==5){
}else if(a==6){
}else if(a==7){
}else if(a==8){
}else if(a==9){
}else if(a==10){
}else if(a==11){
cout<<"你打败了灵萌,灵萌妈妈找上门来,放了个大伊万,你死了";
return 0;
}else if(a==12&&hyy==0){
cout<<"你发现他是你亲戚,他帮你打BOOS,他死了,但BOOS变得十分虚弱\n";
hyy=1;
getchar();
system("cls");
}else if(a==12&&hyy==1){
cout<<"他看你都发现他是你亲戚还死了,你还来打扰他,他把你带去了阎王府";
return 0;
}
} while(a);
}else if(a==2){
do{
cout<<"1 治疗药水,一下回满(90元)\n2 木剑(攻击+10,15元)\n3 石剑(攻击+25,30元)\n4 铁剑(攻击+50,55元)\n5 金剑(攻击+200,210元)\n6 神剑(攻击+10000,10000元)\n0 退出";
cin>>a;
getchar();
if(a==1&&qian>=90){
qian-=90;
xue=xuesx;
system("cls");
}else if(a==2&&qian>=15){
qian-=15;
gongji+=10;
system("cls");
}else if(a==3&&qian>=30){
qian-=30;
gongji+=25;
system("cls");
}else if(a==4&&qian>=55){
qian-=55;
gongji+=50;
system("cls");
}else if(a==5&&qian>=210){
qian-=210;
gongji+=200;
system("cls");
}else if(a==6&&qian>=10000){
qian-=10000;
gongji+=10000;
system("cls");
}else{
cout<<"你没钱!!!";
}
system("cls");
}while(a);
}else if(a==3){
cout<<"经验:"<<jingyan<<" 等级:"<<dengji<<" 还差"<<shenjixy-jingyan<<"可升级\n"<<"攻击力(血量上线的一半):"<<gongji<<"\n血量:"<<xue<<"血量上限:"<<xuesx;
getchar();
system("cls");
}else if(a==4){
cout<<"1.存档\n2.读档";
cin>>a;
if(a==1){
ofstream out("data.in", ios::app);
if (out.is_open())
{
out << jingyan <<"\n"<< dengji <<"\n"<<shenjixy<<"\n"<< gongji<<"\n"<< xue<<"\n"<<xuesx<<"\n"<<qian<<"\n"<<name;
out.close();
}
}else if(a==2){
ifstream inFile;
inFile.open("data.in");
if (!inFile) {
cout << "没有!!!,你搁这装啥呢?";
exit(1);
}
inFile>>jingyan;
inFile>>dengji;
inFile>>shenjixy;
inFile>>gongji;
inFile>>xue;
inFile>>xuesx;
inFile>>qian;
inFile>>name;
inFile.close();
}else{
cout<<"别乱输,食不食油饼";
}
getchar();
system("cls");
}else if(a==5){
return 0;
}else{
cout<<"别乱输,食不食油饼";
getchar();
system("cls");
}
}
}else if(ch=="N"){
cout<<"好吧,人体蒸发了";
}else{
cout<<"别乱输,食不食油饼";
}
}else{
cout<<"人体蒸发了";
}
}
//本游戏由陈明瀚开发,如需转载,请标明转载处