当前位置:   article > 正文

C++制作游戏(整合),《仅1500行》 ,代码奉上_c++游戏代码

c++游戏代码
  1. //#include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<Windows.h>
  4. #include<conio.h>
  5. #include<cstring>
  6. #include<cstdio>
  7. #include<ctime>
  8. #include"cmath"
  9. //#define IsKeyDown(VK_NAME) ((GetAsyncKeyState(VK_NAME) & 0x8000) ? true:false)
  10. #define mm2 1200
  11. #define mm1 700
  12. #define mm3 1900
  13. #define ctl 857
  14. #define mop 10000
  15. using namespace std;
  16. string xiaotishi[200]={"","首先是活下来,再考虑别的","日出而作,日落而息","食用鱼类可获得不同的增益","",""};
  17. /*int vf(int x,int t){
  18. if(x==t/2-1){return t/2+t/2-t;}
  19. else{return 100;}
  20. }
  21. int ttle(int fffa)
  22. {
  23. fffa-=1;
  24. return fffa;
  25. }*/
  26. void gettime()
  27. {
  28. time_t rawtime;
  29. struct tm *ptminfo;
  30. time(&rawtime);
  31. ptminfo = localtime(&rawtime);
  32. printf(": %02d-%02d-%02d %02d:%02d:%02d(鸡霓太美)",
  33. ptminfo->tm_year + 1900, ptminfo->tm_mon + 1, ptminfo->tm_mday,
  34. ptminfo->tm_hour, ptminfo->tm_min, ptminfo->tm_sec);
  35. }
  36. void zairu()//组件
  37. {
  38. int bl=70;
  39. int righl=0;
  40. for(int i=1;i<=20;i++)
  41. {
  42. if(xiaotishi[i]!=""){righl+=1;}
  43. }
  44. srand((int)time(0));
  45. int tim=rand()%righl+1;
  46. system("cls");
  47. for(int i=1;i<=bl+4;i+=1){
  48. int timett=25+(int)(75.0 * rand()/(RAND_MAX+1.0));
  49. if(i==bl+1){
  50. cout<<" \n";
  51. cout<<" \n";
  52. cout<<" \n";
  53. cout<<" (\\ \n";
  54. cout<<" / \\ \n";
  55. cout<<" / | \n";
  56. cout<<" / | \n";
  57. cout<<" | \\ \n";
  58. cout<<" / \\ \n";
  59. cout<<" |________|____________ \n";
  60. cout<<" | | \n";
  61. cout<<" \\ / \n";
  62. cout<<" | / \n";
  63. cout<<" \\ | \n";
  64. cout<<" \\ | \n";
  65. cout<<" \\ / \n";
  66. cout<<" (/ \n";
  67. cout<<" \n";Sleep(300); system("cls");continue;
  68. }else if(i==bl+2){
  69. cout<<" \n";
  70. cout<<" \n";
  71. cout<<" \n";
  72. cout<<" (\\ \n";
  73. cout<<" / \\ \n";
  74. cout<<" / | \n";
  75. cout<<" / | \n";
  76. cout<<" / \\ \n";
  77. cout<<" / \\ \n";
  78. cout<<" [___________|___________ \n";
  79. cout<<" \\ | \n";
  80. cout<<" \\ / \n";
  81. cout<<" \\ / \n";
  82. cout<<" \\ | \n";
  83. cout<<" \\ | \n";
  84. cout<<" \\ / \n";
  85. cout<<" (/ \n";
  86. cout<<" \n";
  87. Sleep(300);system("cls"); continue;
  88. }
  89. else if(i==bl+3){
  90. cout<<" \n";
  91. cout<<" \n";
  92. cout<<" \n";
  93. cout<<" (\\ \n";
  94. cout<<" / \\ \n";
  95. cout<<" / | \n";
  96. cout<<" / | \n";
  97. cout<<" / \\ \n";
  98. cout<<" / \\ \n";
  99. cout<<" [_______________|_____ \n";
  100. cout<<" | | \n";
  101. cout<<" \\ / \n";
  102. cout<<" \\ / \n";
  103. cout<<" \\ | \n";
  104. cout<<" \\ | \n";
  105. cout<<" \\ / \n";
  106. cout<<" (/ \n";
  107. cout<<" \n"; Sleep(350);system("cls"); continue;
  108. }
  109. else if(i==bl+4){
  110. cout<<" \n";
  111. cout<<" \n";
  112. cout<<" \n";
  113. cout<<" (\\ \n";
  114. cout<<" | \\ \n";
  115. cout<<" | | \n";
  116. cout<<" | | \n";
  117. cout<<" | \\ \n";
  118. cout<<" | \\ \n";
  119. cout<<" | | - -\n";
  120. cout<<" | | - - \n";
  121. cout<<" | / - - \n";
  122. cout<<" | / \n";
  123. cout<<" | | \n";
  124. cout<<" | | \n";
  125. cout<<" | / \n";
  126. cout<<" (/ \n";
  127. cout<<" \n";Sleep(450);system("cls"); continue;
  128. }
  129. else{
  130. cout<<" \n\n";
  131. cout<<" 正 在 加 载 中... \n\n";
  132. cout<<" (\\ \n";
  133. cout<<" | \\ \n";
  134. cout<<" | | \n";
  135. cout<<" | | \n";
  136. cout<<" | \\ \n";
  137. cout<<" | \\ \n";
  138. cout<<" |____|__________________ \n";
  139. cout<<" | | \n";
  140. cout<<" | / \n";
  141. cout<<" | / \n";
  142. cout<<" | | \n";
  143. cout<<" | | \n";
  144. cout<<" | / \n";
  145. cout<<" (/ \n\n";
  146. }
  147. cout<<" ";for(int iff=1;iff<=bl;iff++){cout<<"_";}cout<<"\n";
  148. cout<<" |";for(int j=1;j<=i;j++){cout<<"▇";}for(int k=1;k<=bl-i;k++){cout<<" ";}cout<<" |\n";
  149. cout<<" ";for(int itt=1;itt<=bl;itt++){cout<<"▔";}cout<<"\n";
  150. cout<<" "<<i*100/bl<<"% \n";
  151. cout<<" 小提示:"<<xiaotishi[tim];
  152. Sleep(timett);
  153. system("cls");
  154. }Sleep(400);
  155. }
  156. const long long MAXN=10000000000;
  157. int fishjez[30]={0,80,40,60,90,100,85,55,75,25,25,40,60,50,45,130,70};
  158. string cfnm[25]={"","烤肉","烤鱼","荒野烤肉","烤土豆","肉汤","土豆泥","秘制炖肉","","","","",""};
  159. int cfjez[25]={0,95,80,130,105,155,135,200};
  160. string gjfxx[30]={"","獠牙","利爪","笙忼术","笙电术","土玄术","战斧","法杖","易闽术","鸡汤术","篮球","易慴术","戟埕术","黑子"};
  161. string fishing[200]={"","石斑鱼","螃蟹","条石斑","鲭鱼","鲶鱼","红鳟鱼","海鲂","小鲨鱼","海参","鳐鱼","沙丁鱼","鳕鱼","蝴蝶鱼","章鱼","秋刀鱼","罗非鱼","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""};
  162. string fms[8]={"","I","II","III","IV","V"};
  163. string dfs1[20]={"","","",""};
  164. struct o{
  165. int times;
  166. int jjes;
  167. }fishs[1000];
  168. struct sc{
  169. int ts;
  170. int js;
  171. }cfs[505];
  172. int main(){ for(int i=1;i<=7;i++){cfs[i].js =cfjez[i];}
  173. system("title 快乐游戏机");
  174. for(int i=1;i<=14;i+=1){fishs[i].jjes =fishjez[i];}string gjfx;int ttk=0;
  175. char a1[100][100]={
  176. "################################### ",
  177. "#! # *# # ",
  178. "###### ##### ##### ###### ",
  179. "# * # ",
  180. "##### ########## ######## ##### ",
  181. "# ## *# # # ## # ",
  182. "# ### # # # ### # ",
  183. "# #### ######## ###### #### # ",
  184. "# ## ## # ",
  185. "# ######### ######## # ",
  186. "# ## ## @ # ",
  187. "############ #### ########### ",
  188. "# ## ## # ",
  189. "### ## ### ### ### # ",
  190. "#* # #@ # ",
  191. "################################### ",
  192. " ",
  193. };
  194. char a2[100][100]={
  195. "################################### ",
  196. "#! ### # ",
  197. "####### ### ######## # ",
  198. "# ### ### * # # ",
  199. "# ### ########### # ",
  200. "# ###### ### # ",
  201. "# # ################ # ",
  202. "# ### # # ",
  203. "# # * # ################ ",
  204. "# ###### ### *# # ",
  205. "# ### ##### # ",
  206. "# ### # # # ",
  207. "# ### # # # @ # ",
  208. "# ### ######## # # # ",
  209. "# # # ",
  210. "################################### ",
  211. " ",
  212. };
  213. char a3[100][100]={
  214. "################################### ",
  215. "# @ ##### # # # ",
  216. "# # # &# # # # # & # # ",
  217. "# # # ## # # # *# # ",
  218. "# ## ## ## ###### # ",
  219. "# & # # # # # # ",
  220. "################# ################# ",
  221. "# ! # ",
  222. "################# ################# ",
  223. "# # # # #* # ",
  224. "# # ## ## # # # ",
  225. "# * ### # #@ # # # ",
  226. "# ### # # # & # # ",
  227. "##### # # ########### # ",
  228. "#& ######## # # @ # ",
  229. "################################### ",
  230. " ",
  231. };
  232. char a4[100][100]={
  233. "################################### ",
  234. "# # # * # ",
  235. "# ###### # ! # ###### # ",
  236. "# ### ### # ",
  237. "####### ## ## ####### ",
  238. "# * ## # # ## # ",
  239. "# ## ###### ##### ## # ",
  240. "# ## ## ## ## # ",
  241. "# ## ## ## ## # ",
  242. "# ### @ # ### # * ### # ",
  243. "# ##* ## ## ## # ",
  244. "# # ## # # ## # # ",
  245. "# # # # # @ # ",
  246. "# ####### ####### # ",
  247. "# # ",
  248. "################################### ",
  249. " ",
  250. };
  251. char a5[100][100]={
  252. "################################### ",
  253. "#! *# ",
  254. "# #### ### ###### ",
  255. "######### # ##### # ",
  256. "# @ # #### # ",
  257. "####### ## ###### # ### # ",
  258. "# ### *# # # # ",
  259. "# ### ###### # # # ",
  260. "# ### ### # # # ",
  261. "# ### ### # # # ",
  262. "#### ### ### # # # # ",
  263. "# ##### #### # # # # ",
  264. "# ### # # # # ",
  265. "# ##### ########### ### ##",
  266. "# ### ## @ #",
  267. "####################################",
  268. " ",
  269. };
  270. string s20;int fmt;string fucks;
  271. int k10=0;string sb0="欢迎使用快乐游戏机,尊敬的用户,快乐游戏机竭诚为您服务!",sb1="欢迎来到鸡仙大陆!",sb2="这片大陆危机四伏,你要想方设法的生存下去,并逃出这里!";
  272. for(int i=0;i<=sb0.size()-1;i++){
  273. cout<<sb0[i];
  274. Beep(mm3,45);Sleep(13);}
  275. Sleep(620);Beep(mm3,60);
  276. cout<<endl<<" 请输入游戏机的密码(6位):" ; Sleep(600);system("cls");
  277. char hhhh;string qa;
  278. cout<<"\n\n 0 1 2\n\n";
  279. cout<<" 3 4 5\n\n";
  280. cout<<" 6 7 8\n\n";
  281. cout<<" 坤 9 坤";
  282. for(int i=1;i<=51;i++){
  283. if(i==50){system("cls");system("title 帮帮我");
  284. cout<<"\n\n ";
  285. for(int fo=1;fo<=6;fo++)
  286. {cout<<" ";
  287. for(int j=1;j<=fo;j++){cout<<"·";}
  288. cout<<"\n\n 0 1 2\n\n";
  289. cout<<" 3 4 5\n\n";
  290. cout<<" 6 7 8\n\n";
  291. cout<<" 坤 9 坤"; Sleep(555);system("cls");
  292. }
  293. Sleep(400);system("title 孤岛生存");break;}
  294. hhhh=_getch();qa+=hhhh;system("cls");cout<<"\n\n ";
  295. for(int mt=1;mt<=i%6;mt++){cout<<"·";}
  296. cout<<"\n\n 0 1 2\n\n";
  297. cout<<" 3 4 5\n\n";
  298. cout<<" 6 7 8\n\n";
  299. cout<<" 坤 9 坤";
  300. if(i%6==0)
  301. {Sleep(130);
  302. if(qa=="123456"){cout<<"\n 密码正确!"<<endl;Beep(mm2,201);break; }
  303. cout<<"\n 密码错误 ";Beep(mm1,500);
  304. if(i>1){cout<<"已尝试"<<k10+1<<"次"<<endl;Sleep(300);}k10+=1;
  305. if(i==8){cout<<"\n";for(int i=1;i<=6;i+=1){Sleep(499);cout<<i;}cout<<"\n";Sleep(555);break;}
  306. qa="";system("cls");
  307. cout<<"\n\n 0 1 2\n\n";
  308. cout<<" 3 4 5\n\n";
  309. cout<<" 6 7 8\n\n";
  310. cout<<" 坤 9 坤";
  311. }
  312. }
  313. while(2){
  314. cout<<"请问你想玩什么游戏?"<<endl;Sleep(500);
  315. cout<<"双城之战请输入:1 抽卡牌请输入:2 解救人质请输入:3 石头剪刀布请输入:4 鸡仙大陆(生存版)请输入:5"<<endl;
  316. long long zidan=0;
  317. //木材cll1 藤条cll2 棕榈叶cll3 铁锭cll4 石片cll5 青金石cll6
  318. int cl7=0,ml1=0,tl1=0,tl2=0,tl3=0,tl4=0,tl5=0,tl6=0,tl7=0,plof=0;
  319. int cll1[49]={0,3,2,10,3,2,5,12,20,0,2,4,6,5,1,1,0,0,1,0,0,0,4,0,0,2,500,5,0,0,10,100,0,0,10,10};
  320. int cll2[49]={0,0,10,15,0,2,3,5,12,0,0,3,4,3,5,30,5,0,0,0,1,0,0,0,0,1,0,7,0,40,0,100,0,0,50,0};
  321. int cll3[49]={0,3,0,15,2,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,2,0,0,10,50,100,80,200,0};
  322. int cll4[49]={0,0,1,7,0,0,0,0,4,0,0,0,2,0,0,0,20,1,1,1,1,5,0,0,2,4,500,0,4,0,0,0,0,0,100,5};
  323. int cll5[49]={0,0,0,0,1,0,0,2,0,2,3,0,1,0,10,0,5,0,0,0,0,0,0,0,0,0,0,5,0,20,0,0,30,0,0,0};
  324. int jnj[40]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  325. int hs[10]={0,0,0},hss[10]={0,0,0};
  326. int j11[40]={0,1,2,4,6,10,15,20,60,150,151};
  327. int j12[40]={0,7,15,25,50,100,220,340,1314,3000,250250,857857,22222,53453};
  328. int j13[40]={0,25,50,90,175,220,350,700,1100,4500,3838,3838438,43553,114514};
  329. int linjian[40]={0,0,0,0,0,0};
  330. int jjjb[20]={0,7,15,32,60,120,400,700,1000,2500,3830,413,131,3123};
  331. int ve[20]={0,12,12,12};string fz[30]={"","野猪","毒腥","吞噬","火电","咀骨","僵尸","协增","黑子","长臂","召唤","黄眸","蛛形","鸡王"};
  332. int gjs[30]={0,2,3,2,7,10,12,19,31,54,92,8,15,100},xls[30]={0,15,21,70,40,82,100,120,200,2423,104664,5436,3665,200};
  333. int jjjj[20]={0,10,14,5,32,47,69,105,180,350,1000,20,35,1500};
  334. string ssss[30]={"","小野猪","小狮子","小鳄龟","火电怪","土蜥蜴","野人酋长","森林女巫","森林巨人","钏姍钾","蔡虚坤","人物3","人物4","人物5"};
  335. int xxxx[20]={0,160,220,700,340,470,600,1000,1700,20000,500000,114514,20005,1231};
  336. int jbs[40]={0,90,15,120,220,400,550,300,1,8,1,10,35,40,20,400,500,1300,1800,10000,25000};
  337. string sss[20]={"","绿色平原","沙漠丘陵","世纪峡谷","死亡瀑布","黑暗森林","野人部落","僵尸村落","沉船","远山","废弃的篮球场","山顶洞","大山顶洞","超大的山顶洞"};
  338. int xlz[100]={0,320,170,250,300,250,220,220,400,2000};
  339. int gjz[100]={0,28,35,16,14,18,10,13,7,50};
  340. int ltz[100]={0,200,400,200,180,220,270,250,100,50};
  341. int wgj[100]={0,120,100,150,130,110,200,500,66666};
  342. int dssgj[100]={0,12,15,5,100,160,220,350,1250,4500,6000,55,70,63};
  343. int dssxl[100]={0,160,220,700,450,1000,1200,2000,7000,20000,500000,100000,320000,780000};
  344. string ds[100]={"","小野猪","小狮子","小鳄龟","火电怪","土蜥蜴","野人酋长","森林女巫","小黄嘉安","钏姍钾","蔡虚坤"};
  345. string wnm[100]={"","天空之刃","风鹰剑","原木刀","阿莫斯之弓","赤沙之杖","无工之剑","狼末","反物质核弹",""};
  346. string cnm[100]={"","宠物1","宠物2","宠物3","宠物4","宠物5","宠物6","","","",""};
  347. int fmtj=0,fmtj2=0,fmtj3=0;int jl=150;
  348. int kjk;int uxl;int fy=0;int cl6=0;string dfs,dfs2; int ppm,ppm2;
  349. int max1=0,max2=0;int zxc=0;int yd;int uyu;
  350. long long q=0,am&
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/神奇cpp/article/detail/1001545
推荐阅读
相关标签
  

闽ICP备14008679号