当前位置: 首页 > news >正文

自己做的游戏

所有改动都会在此显示,实时更新,目前版本(5.7)可运行版:

/*
1.报错:
[Error]'mt19937'was not declared in this scope
1.解决方案:
(1)点击工具[T] (2)编译选项[C] (3)在下方文本框内加入这行代码:-std=c++14
*/ 
#define KEY_DOWN(VK_NONAME)((GetAsyncKeyState(VK_NONAME) & 0x8000)?1:0)
#include<bits/stdc++.h>
#include<windows.h>
#include<algorithm>
#include<iostream>
#include<fstream>
#include<cstring>
#include<time.h>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
using namespace std;
string player="wzh";
ifstream fin("game.wzh",ios_base::app);
int allscore=0,playtime=0;
char c[1000][1000];
void print(string a){/*文本居中*/HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);CONSOLE_SCREEN_BUFFER_INFO csbi;GetConsoleScreenBufferInfo(hConsole,&csbi);printf("\033[%dC%s",(csbi.dwSize.X-a.length())/2,a.c_str());
} 
void reset(){/*重置界面*/system("color 0f"); system(("title "+player+"的游戏空间").c_str());system("cls");
}
void rest(){/*暂停*/system("pause");
}
int random(int a,int b){/*随机数*/mt19937 rnd(time(NULL));b-=a;return(rnd()%(b+1))+a;
}
void start(){/*开始界面*/reset();print("欢迎来到"+player+"的游戏空间");cout<<endl<<endl;print("目前获得了"+to_string(allscore)+"积分");cout<<endl<<endl;print("退出:a/A");cout<<endl<<endl;print("获得存档:b/B");cout<<endl<<endl;print("打开存档:c/C");cout<<endl<<endl;print("刷新:d/D");cout<<endl<<endl;print("温馨提示:游戏前请切换至大写模式,游戏编号以最后一个字符为准");cout<<endl<<endl;print("1.躲避障碍");cout<<endl<<endl;print("2.手速射击");cout<<endl<<endl;print("3.恐龙跳一跳");cout<<endl<<endl;print("4.移动小人");cout<<endl<<endl;print("5.扫雷");cout<<endl<<endl;print("6.贪吃蛇");cout<<endl<<endl;print("7.阻止污染");cout<<endl<<endl;
}
void write(){/*获得存档*/string a,cnt;reset();cout<<"请输入你的昵称:";getline(cin,player);ofstream fout("game.wzh");fout<<player.size()<<" ";cout<<endl<<"请再次输入你的密码:";getline(cin,a);cnt=player+" "+to_string(allscore);while(cnt.size()<a.size()){cnt+=' ';}while(a.size()<cnt.size()){a+=' ';}fout<<a.size()<<endl;for(int i=0;i<a.size();i++){fout<<a[i]-cnt[i]<<" "; }cout<<endl<<"创建存档完成"<<" ";rest();
}
void read(){/*读取存档*/reset();string a,b;int c,l,n,d;cout<<"请输入你的密码:";getline(cin,a);fin>>l>>n;for(int i=a.size();i<=n;i++){a+=' ';}for(int i=0;i<l;i++){fin>>c;b+=char(a[i]-c);}fin>>c;for(int i=l+1;i<n;i++){fin>>c;d*=10;d+=(a[i]-(c+'0'));}player=b;allscore=d;cout<<"存档读取成功,存档信息:昵称:"<<player<<" 分数:"<<allscore<<endl;rest();
}
void dbza(){/*躲避障碍*/reset();int w=10,a=0,fs=0,yn=1;while(yn){int d=random(0,17);for(int n=0;n<10;n++){for(int i=0;i<10;i++){for(int t=0;t<18;t++){if(i==a&&t==d){c[i][t]='v';}else if((i==9||i==8)&&t==w){c[i][t]='^';}else{c[i][t]=' ';}if((n==8||n==9)&&(d==w)){reset();cout<<"游戏结束,得分:"<<fs;allscore+=fs;Sleep(500);yn=0;}if(yn==0){break;}}if(yn==0){break;}cout<<endl;}if(yn==0){break;}reset();for(int i=0;i<10;i++){for(int j=0;j<18;j++)
http://www.dtcms.com/a/586291.html

相关文章:

  • 海南住房城乡建设网站淘宝导购网站模板
  • 三维空间平面方程
  • 网站 售后服务申请域名邮箱
  • 手机App里的动画是如何实现的-安卓动画深入探索
  • Lua中的可变参数
  • 夜晚的梦
  • 销售平台网站建设方案手机网站开发建设方案
  • Git 入门教程
  • 建行企业网站如何学编程入门教程
  • 做国外直播网站有哪些宜春做网站 黑酷seo
  • 重生归来,我要成功 Python 高手--day33 决策树
  • AI大模型全景图:十大核心能力与十大应用领域详解,附学习资源(建议收藏)
  • 学习Linux——软件管理
  • 广东品牌网站建设报价表网站建设中的财务预算
  • 什么网站的易用性重庆seo网站推广费用
  • 速卖通测评自养号技术:搭建安全稳定账号体系,流量销量双突破
  • 22-webpack案例:36kr
  • PCB批量处理命令
  • 网站建设 制作教程 pdf在山东和网页有关的公司
  • Go 语言接口
  • wordpress网站如何迁移电商网站建设课程
  • Keil编译出现:Missing Compiler Version 5
  • 十大免费网站推广平台有哪些创意设计素材
  • 为什么网站浏览不是做的那样农村自建房设计图软件
  • 如何设计一份精美到ppt
  • 网站如何做ssl认证计算机网站建设是什么
  • MySQL——数据库基础
  • 配置flutter鸿蒙的环境和创建并运行第一个flutter鸿蒙项目【精心制作】
  • UE核心架构概念
  • 叙述一个网站的建设过程免费网站建设绑定域名