第1个回答 推荐于2017-11-29
/*===========================Program Description==========================*/ /*程序名称:game.c */ /*程序目的:打砖块游戏演示 */ /*written by :董大钿 */ /*========================================================================*/ #include "graphics.h" #include "stdio.h" #include "conio.h" /*所需的头文件*/ int on; /*声明具有开关作用的全局变量*/ static int score; /*声明静态的记分器变量*/ /* 定义开始界面函数*/ int open() { setviewport(100,100,500,380,1); /*设置图形窗口区域*/ setcolor(4); /*设置作图色*/ rectangle(0,0,399,279); /*以矩形填充所设的图形窗口区域*/ setfillstyle(SOLID_FILL,7); /*设置填充方式*/ floodfill(50,50,4); /*设置填充范围*/ setcolor(8); settextstyle(0,0,9); /*文本字体设置*/ outtextxy(90,80,"BALL"); /*输出文本内容*/ settextstyle(0,0,1); outtextxy(110,180,"version 1.0"); outtextxy(110,190,"made by ddt"); setcolor(128); settextstyle(0,0,1); outtextxy(120,240,"Press any key to continue......"); } /*定义退出界面函数*/ int quitwindow() { char s[100]; /*声明用于存放字符串的数组*/ setviewport(100,150,540,420,1); setcolor(YELLOW); rectangle(0,0,439,279); setfillstyle(SOLID_FILL,7); floodfill(50,50,14); setcolor(12); settextstyle(0,0,8); outtextxy(120,80,"End"); settextstyle(0,0,2); outtextxy(120,200,"quit? Y/N"); sprintf(s,"Your score is:%d",score);/*格式化输出记分器的值*/ outtextxy(120,180,s); on=1; /*初始化开关变量*/ } /*主函数*/ main() { int gdriver,gmode; gdriver=DETECT; /*设置图形适配器*/ gmode=VGA; /*设置图形模式*/ registerbgidriver(EGAVGA_driver); /*建立独立图形运行程序*/ initgraph(&gdriver,&gmode,""); /*图形系统初试化*/ setbkcolor(14); open(); /*调用开始界面函数*/ getch(); /*暂停*/ while(1) /*此大循环体控制游戏的反复重新进行*/ { int driver,mode,l=320,t=400,r,a,b,dl=5,n,x=200,y=400,r1=10,dx=-2,dy=-2;/*初始化小球相关参数*/ int left[100],top[100],right[100],bottom[100],i,j,k,off=1,m,num[100][100];/*方砖阵列相关参数*/ static int pp; static int phrase; /*一系列起开关作用的变量*/ int oop=15; pp=1; score=0; driver=DETECT; mode=VGA; registerbgidriver(EGAVGA_driver); initgraph(&driver,&mode,""); setbkcolor(10); cleardevice(); /*图形状态下清屏*/ clearviewport(); /*清除现行图形窗口内容*/ b=t+6; r=l+60; setcolor(1); rectangle(0,0,639,479); setcolor(4); rectangle(l,t,r,b); setfillstyle(SOLID_FILL,1); floodfill(l+2,t+2,4); for(i=0,k=0;i<=6;i++) /*此循环绘制方砖阵列*/ { top[i]=k; bottom[i]=top[i]+20; k=k+21; oop--; for(j=0,m=0;j<=7;j++) { left[j]=m; right[j]=left[j]+80; m=m+81; setcolor(4); rectangle(left[j],top[i],right[j],bottom[i]); setfillstyle(SOLID_FILL,j+oop); floodfill(left[j]+1,top[i]+1,4); num[i][j]=pp++; } } while(1) /*此循环控制整个动画*/ { while(!kbhit()) { x=x+dx; /*小球运动的圆心变量控制*/ y=y+dy; if(x+r1>r||x+r1<r) { phrase=0;} if((x-r1<=r||x+r1<=r)&&x+r1>=l) { if(y<t) phrase=1; if(y+r1>=t&&phrase==1) {dy=-dy;y=t-1-r1;} } if(off==0) continue; for(i=0;i<=6;i++) /*此循环用于判断、控制方砖阵列的撞击、擦除*/ for(j=0;j<=7;j++) { if((x+r1<=right[j]&&x+r1>=left[j])||(x-r1<=right[j]&&x-r1>=left[j])) { if(( y-r1>top[i]&&y-r1<=bottom[i])||(y+r1>=top[i]&&y+r1<=bottom[i] )) { if(num[i][j]==0) {continue; } setcolor(10); rectangle(left[j],top[i],right[j],bottom[i]); setfillstyle(SOLID_FILL,10); floodfill(left[j]+1,top[i]+1,10); dy=-dy; num[i][j]=0; score=score+10; printf("%d\b\b\b",score); } } if((y+r1>=top[i]&&y+r1<=bottom[i])||(y-r1>=top[i]&&y-r1<=bottom[i])) { if((x+r1>=left[j]&&x+r1<right[j])||(x-r1<=right[j]&&x-r1>left[j])) { if(num[i][j]==0) { continue;} setcolor(10); rectangle(left[j],top[i],right[j],bottom[i]); setfillstyle(SOLID_FILL,10); floodfill(left[j]+1,top[i]+1,10); dx=-dx; num[i][j]=0; score=score+10; printf("%d\b\b\b",score); } } } if(x+r1>639) /*控制小球的弹射范围*/ {dx=-dx;x=638-r1;} if(x<=r1) {dx=-dx;x=r1+1;} if(y+r1>=479) {off=0;quitwindow();break;} if(y<=r1) {dy=-dy;y=r1+1;} if(score==560) {off=0;quitwindow();break;} setcolor(6); circle(x,y,r1); setfillstyle(SOLID_FILL,14); floodfill(x,y,6); delay(1000); setcolor(10); circle(x,y,r1); setfillstyle(SOLID_FILL,10); floodfill(x,y,10); } a=getch(); setcolor(10); rectangle(l,t,r,b); setfillstyle(SOLID_FILL,10); floodfill(l+2,t+2,10); if(a==77&&l<=565) /*键盘控制设定*/ {dl=20;l=l+dl;} if(a==75&&l>=15) {dl=-20;l=l+dl;} if(a=='y'&&on==1) break; if(a=='n'&&on==1) break; if(a==27) {quitwindow();off=0;} r=l+60; setcolor(4); rectangle(l,t,r,b); setfillstyle(SOLID_FILL,1); floodfill(l+5,t+5,4); delay(100); } if(a=='y'&&on==1) /*是否退出游戏*/ {break;} if(a=='n'&&on==1) { continue;} } closegraph(); }本回答被提问者采纳
第2个回答 2020-03-12
void panduan2() { if(win>=10){ out("已解锁全部游戏"); Sleep(2000); abc=1; win-=10; }else{ out("权限不够"); Sleep(1000); } } void waigua(){ printf("密码1:"); scanf("%d",&a); printf("密码2:"); scanf("%d",&b); c=a+b; if(c==286){ score+=200; printf("谁是学神?"); cout<<endl; printf("1 .徐若宸"); cout<<endl; printf("2 .文雅洁"); cout<<endl; printf("3 .朱持正"); cout<<endl; printf("4 .杨程程"); cout<<endl; printf("5 .张紫涵"); cout<<endl; printf("6 .石欣宇"); cout<<endl; printf("7 .其他人"); cout<<endl; printf("9 .你自己"); cout<<endl; printf("10.这一题不适合我,退出"); cout<<endl; scanf("%d",&d); if(d==1||d==2||d==3){ out("你答对了,真棒"); Sleep(2000); score+=500; return; } if(d==4||d==5||d==6||d==7||d==8){ out("错了,减100毛爷爷"); Sleep(2000); score-=100; return; } if(d==9){ out("怎么可能?减200毛爷爷"); Sleep(2000); score-=200; return; } if(d==10){ out("拜拜,给你1个毛爷爷"); Sleep(2000); score+=1; return; } if(d>10){ out("调皮蛋,罚50毛爷爷"); Sleep(2000); score-=50; return; } } else{ cout<<"你答错了!Sorry!O(∩_∩)O"<<endl; Sleep(1000); score=0; return; } } void chengfa() { int cv; if(score<=0) { printf("惩罚开始"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSS5SSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"); cout<<endl; printf("刚刚多余的数字在第几行第几列"); scanf("%d",&cv); int cvv; cin >> cvv; if(cv==6&&cvv==19) {//6 19 score+=50; lose=10000000; screen(); } else { chengfa(); system("cls"); } } } void color() { out("你要什么字体颜色?"); cout<<endl; out("黑色:按1"); cout<<endl; out("蓝色:按2"); cout<<endl; out("绿色:按3"); cout<<endl; out("浅绿色:按4"); cout<<endl; out("红色:按5"); cout<<endl; out("紫色:按6"); cout<<endl; out("黄色:按7"); cout<<endl; out("白色:按8"); cout<<endl; out("灰色:按9"); cout<<endl; out("淡蓝色:按A"); cout<<endl; out("淡绿色:按B"); cout<<endl; out("淡浅绿色:按C"); cout<<endl; out("淡红色:按D"); cout<<endl; out("淡紫色:按E"); cout<<endl; out("淡黄色:按F"); cout<<endl; out("亮白色:按G"); cout<<endl; char c; cin>>c; switch(c) { case '1': system("color 0"); break; case '2': system("color 1"); break; case '3': system("color 2"); break; case '4': system("color 3"); break; case '5': system("color 4"); break; case '6': system("color 5"); break; case '7': system("color 6"); break; case '8': system("color 7"); break; case '9': system("color 8"); break; case 'A': system("color 9"); break; case 'B': system("color A"); break; case 'C': system("color B"); break; case 'D': system("color C"); break; case 'E': system("color D"); break; case 'F': system("color E"); break; case 'G': system("color F"); break; default: system("color"); break; } out("调颜色成功。"); } void judge() { if(player[cishu]==1) { if(computer==2) { computer_lose(); } if(computer==3) { player_lose(); } if(computer==1) { tin(); } } if(player[cishu]==2) { if(computer==3) { computer_lose(); } if(computer==1) { player_lose(); } if(computer==2) { tin(); } } if(player[cishu]==3) { if(computer==1) { computer_lose(); } if(computer==2) { player_lose(); } if(computer==3) { tin(); } } } void zhiliwenda() { system("cls"); system("color 9F"); cout<<"开始智力问答!"<<endl; Sleep(1000); for(int i=1;i<=10;i++) timu(rand()%10); tili+=5; } void timu(int in) { int input; switch(in) { case 0: { out("0~31有几个数?"); cout<<endl; cin>>input; if(input==32) { out("被你答对了,真是不可思议!"); cout<<endl; return; } else { out("脑子有问题。"); cout<<endl; timu(rand()%10); } } break; case 1: { out("0,1,1,2,3,5,8,后面是什么?"); cout<<endl; cin>>input; if(input==13) { out("被你答对了,真是不可思议!"); cout<<endl; return; } else { out("sb。"); cout<<endl; timu(rand()%10); } } break; case 2: { out("9,61,52,63,94,后面是什么?"); cout<<endl; cin>>input; if(input==64) { out("被你给答对了,真是不可思议!"); cout<<endl; return; } else { out("6666666。"); cout<<endl; timu(rand()%10); } } break; case 3: { out("求7分之1的小数点后第1000位是多少。"); cout<<endl; cin>>input; if(input==8) { out("被你答对了,真是不可思议!"); cout<<endl; return; } else { out("这都不会。"); cout<<endl; timu(rand()%10); } } break; case 4: { out("求13分之1的小数点后第1000位是多少。"); cout<<endl; cin>>input; if(input==9) { out("被你答对了,真是不可思议!"); cout<<endl; return; } else { out("这都不会。"); cout<<endl; timu(rand()%10); } } break; case 5: { out("2^16=?"); cout<<endl; cin>>input; if(input==65536) { out("被你答对了,真是不可思议!"); cout<<endl; return; } else { out("这都不会。。。"); cout<<endl; timu(rand()%10); } } break; case 6: { out("一吨水多少钱?"); cout<<endl; cin>>input; if(input>=3&&input<=8) { out("被你答对了,真是不可思议!"); cout<<endl; return; } else { out("这都不会。666666666。。。"); cout<<endl; timu(rand()%10); } } break; case 7: { out("求你一天吃几碗饭。"); cout<<endl; cin>>input; if(input<=2) { out("被你答对了,真是不可思议!"); cout<<endl; return; } else { out("吃货!"); cout<<endl; timu(rand()%10); } } break; case 8: { out("求标准钢琴有几个键。"); cout<<endl; cin>>input; if(input==88) { out("被你答对了,真是不可思议!"); cout<<endl; return; } else { out("这都不会。。。估计不弹钢琴。。。"); cout<<endl; timu(rand()%10); } } break; case 9: { out("本游戏至少有多少行?"); cout<<endl; cin>>input; if(input>=600) { out("被你答对了,真是不可思议!"); cout<<endl; return; } else { out("这都不会。"); cout<<endl; timu(rand()%10); } } break; } } void screan() { while(1) { system("cls"); if(tili<=0) { out("体力为0,休息一会,马上回来!"); cout<<endl; Sleep(2000); int i,yushu; for(i=1;i<=rand()%20;i++) { yushu=i%8; switch(yushu) { case 0: { system("color 0F"); out("吃鸡三级头套装,限购10个哟!"); Sleep(2000); system("cls"); break; } case 1: { system("color 3F"); out("我的世界头套100个,现在大促销,快来买哟!"); Sleep(2000); system("cls"); break; } case 2: { system("color AF"); out("装逼专用机器,还送10年保修哟!"); Sleep(2000); system("cls"); break; } case 3: { system("color BF"); out("吃鸡专用98k,800里外一枪爆头!"); Sleep(2000); system("cls"); break; } case 4: { system("color AB"); out("王者10000000份外挂大放送,手快有手慢无!"); Sleep(2000); system("cls"); break; } case 5: { system("color 0F"); out("Surface Pro 7笔记本电脑出售,抢购只在1秒间!"); Sleep(2000); system("cls"); break; } case 6: { system("color 1F"); out("6666666,6666666,6666666,6666666"); Sleep(2000); system("cls"); break; } } } zhiliwenda(); } out("你现在有"); cout<<score; out("张毛爷爷,"); cout<<meichao; out("美元,"); cout<<tili; out("点体力值,"); cout<<win; out("次胜利,"); cout<<lose; out("次失败,"); cout<<isvip; out("张VIP卡,"); cout<<ismvp; out("张MVP卡,"); cout<<xingyv; out("信誉积分."); cout<<endl; out("现在,你可以有以下选择:"); cout<<endl; out("1:人机大战"); cout<<endl; out("2:购买道具"); cout<<endl; out("3.游戏简介"); cout<<endl; out("4.作者简介"); cout<<endl; out("5:外挂"); cout<<endl; out("6:调整设置"); cout<<endl; out("7:玩玩小游戏"); cout<<endl; out("8:新年快乐!"); int in; cout<<endl; cin>>in; switch(in) { case 1: fight(); screan(); system("cls"); break; case 2: store(); system("cls"); break; case 3: jianjei(); system("cls"); break; case 4: zuozhe(); system("cls"); break; case 5: waigua(); system("cls"); break; case 6: color(); system("cls"); case 7: panduan(); system("cls"); break; case 8: newyear(); system("cls"); break; default: out("输错了,请重试。"); Sleep(1000); } } }
第3个回答 2020-12-08
使用语言:C++使用工具:vs2019
您的浏览器不支持HTML5视频
第4个回答 2020-08-23
//低级版第五人格 #include <iostream> #include <conio.h> #include <ctime> #include <cstdlib> #include <windows.h> #include <cstring> using namespace std; int random(int a,int b){//产生a-b的随机数 return rand()%(b-a+1)+a; } void HideCursor(){//隐藏光标 CONSOLE_CURSOR_INFO cursor_info = {1, 0}; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info); } void gotoxy(int y,int x){//设置光标 COORD loc={x,y}; HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(out,loc); } void hang(int x,int y1,int y2,char ch){//填充 第x行 从y1->y2 gotoxy(x,y1); while(y1<y2){ cout<<ch; y1++; gotoxy(x,y1); } } void lie(int y,int x1,int x2,char ch){//填充 第y列 从x1->x2 gotoxy(x1,y); while(x1<x2){ cout<<ch; x1++; gotoxy(x1,y); } } void pause(){ gotoxy(11,72); cout<<"暂停中..."; char c=getch(); while(c!='p') c=getch(); gotoxy(11,72); cout<<" "; } int move(int rw){ int x=1,y=0;//人物初始位置 int smz=2; int enemy_x,enemy_y; //监管者位置 int rank=40000,enemy_flag=0;//监管者移动速度 int box_x[3],box_y[3];//道具 int box_num=1; int lock_x[3],lock_y[3];//密码机 int lock_num[3]={0,0,0},j=0; for(int i=1;i<=3;i++){ lock_x[i]=random(1,24);//随机密码机位置 lock_y[i]=random(1,34); box_x[i]=random(1,24);//随机道具位置 box_y[i]=random(1,34); } gotoxy(x,y); cout<<"->"; y+=1; gotoxy(3,84); cout<<box_num; gotoxy(5,90); for(int i=0;i<=2;i++){ cout<<lock_num[i]<<" "; } while(1){ enemy_flag=0; enemy_x=random(1,24);//随机监管者初始位置 enemy_y=random(1,34); while(1){ if(_kbhit()){ for(int i=16;i<=19;i++){ gotoxy(i,72); cout<<" "; } gotoxy(3,84); cout<<" "; gotoxy(3,84); cout<<box_num; gotoxy(5,90); for(int i=0;i<=2;i++){ cout<<" "; } gotoxy(5,90); for(int i=0;i<=2;i++){ cout<<lock_num[i]<<" "; } char m=getch(); int x1=x,y1=y; switch(m){ case 'a':y1--;break; case 'd':y1++;break; case 's':x1++;break; case 'w':x1--;break; case 'p':pause(); } if(x1>=1&&x1<25&&y1>=1&&y1<35){ gotoxy(x,y*2); cout<<"."; x=x1; y=y1; if(x==enemy_x&&y==enemy_y){//遇到监管者 break; }else{ gotoxy(x,y*2); cout<<"o"; } if(x==24&&y==34){//出口 int doorLock,a; if(j!=3){ doorLock=INT_MAX; }else{ doorLock=lock_num[0]+lock_num[1]+lock_num[2]; } while(1){ gotoxy(16,72); cout<<"请将三个密码机的密码相加\n"; gotoxy(17,72); cout<<"就可以打开大门,输入0继续寻找\n"; gotoxy(18,72); cin>>a; if(a==0){ break; }else if(doorLock==a){ cout<<"密码正确"; return 0; }else{ return 1; } } } for(int i=1;i<=3;i++){ if(lock_x[i]==x&&lock_y[i]==y){//遇到密码机 int lock_num1=random(1,100),lock_num2; lock_x[i]=0; lock_y[i]=0; while(1){ gotoxy(16,72); cout<<"试试输入频率接受密码~"; cin>>lock_num2; gotoxy(17,72); if(lock_num2>lock_num1){ cout<<"频率太高~\n"; }else if(lock_num2<lock_num1){ cout<<"频率太低~\n"; }else{ cout<<"频率正确,密码为"<<lock_num1<<"\n"; lock_num[j++]=lock_num1; break; } } Sleep(2000); } if(box_x[i]==x&&box_y[i]==y){//遇到道具 box_x[i]=0; box_y[i]=0; box_num++; gotoxy(16,72); switch(rw){ case 1:cout<<"拾取电池一个";break; case 2:cout<<"拾取磨刀石一个";break; case 3:cout<<"拾取镇定剂一个";break; } Sleep(2000); } } } } //监管者移动 enemy_flag++; if(enemy_flag==rank){ gotoxy(enemy_x,enemy_y*2); cout<<" "; if(x<enemy_x){ enemy_x--; }else if(x>enemy_x){ enemy_x++; } if(y<enemy_y){ enemy_y--; }else if(y>enemy_y){ enemy_y++; } gotoxy(enemy_x,enemy_y*2); cout<<"*"; if(x==enemy_x&&y==enemy_y){//遇到监管者 break; } enemy_flag=0; } } for(int i=16;i<=19;i++){ gotoxy(i,72); cout<<" "; } gotoxy(x,y*2); cout<<"x"; gotoxy(16,72); cout<<"遭遇监管者!!!"; cout<<"\n"; gotoxy(17,72); switch(rw){ case 1:{ cout<<"是否使用手电筒,y or n\n"; char c=getch(); if(c=='y'){ gotoxy(17,72); if(box_num>0){ cout<<"监管者被晃晕,你快速逃离现场。\n"; box_num--; break; }else{ cout<<"手电筒发出微弱的光,你才意识到没电了\n"; } } } case 2: case 3: smz--; gotoxy(18,72); cout<<"你无法进行任何抵抗,被监管者打伤,"; gotoxy(19,72); cout<<"借监管者擦刀之际逃跑\n"; Sleep(1000); break; } for(int i=26;i<=28;i++){ gotoxy(i,72); hang(i,0,120,' '); } if(smz>0){ if(rw==3&&box_num>0){ gotoxy(26,2); box_num--; cout<<"监管者造成的伤害使你难以行动,你忍住剧痛,给自己注射了镇定剂。"; Sleep(3000); } if(rw==2&&box_num>0){ gotoxy(26,2); box_num--; cout<<"你因受伤太重而倒地,监管者将你抓起并放在狂欢之椅上\n"; cout<<"监管者离开了,你使用绿化剪剪断枷锁\n"; Sleep(3000); } }else{ int num=2; gotoxy(26,2); cout<<"你因受伤太重而倒地,监管者将你抓起并放在狂欢之椅上\n"; int m=random(1,4),n; while(1){ cout<<"你可以尝试挣扎。前w后s左a右d\n"; char c=getch(); switch(c){ case 'w':n=1;break; case 's':n=2;break; case 'a':n=3;break; case 'd':n=4;break; } if(m==n){ cout<<"你成功挣扎下椅,向远处跑去。\n"; smz++; break; }else{ cout<<"这个方向挣扎不开\n"; num--; } if(num==0){ cout<<"这个方向挣扎不开,你的挣扎引来了监管者,它冷笑着点击了加速按钮,看样子似乎想提"; cout<<"前将你送回庄园。椅子开始旋转。当椅子开始旋转,你才明白似乎只有两次机会。"; return 2; } } } } } int begin(){ int rw;//人物 //背景音乐 //PlaySound("bac1.wav", NULL, SND_FILENAME | SND_ASYNC|SND_LOOP); gotoxy(2,40); cout<<"第五人格(2D版)"; hang(4,0,100,'-'); cout<<"\n"; cout<<" 温馨提示:由于板子较大,请您耐心走路,"; cout<<"不要走到一半砸键盘哈~难度很低,基本上都可以逃生成功"; hang(6,0,100,'-'); cout<<"\n"; gotoxy(7,30); cout<<"w s 选择,k 确定"; hang(8,0,100,'-'); cout<<"\n"; cout<<" 你睁开眼,发现自己身处一个诡异的庄园,远处身材高大面带诡异笑容的是监管者。\n"; cout<<" 监管者的诡异笑声让你清醒,你想起了你的身份,你的身份是\n"; cout<<" 1.慈善家 \n 2.园丁 \n 3.医生\n"; hang(14,5,100,'-'); cout<<"\n"; cout<<" 技能介绍:拥有手电筒,可以晃晕监管者"; hang(21,0,100,'-'); gotoxy(22,20); cout<<"制作:张 力"; hang(23,0,100,'-'); int key=1; gotoxy(10+key,6); cout<<">>"; while(1){ if(_kbhit()){ char k=getch(); if(k=='s'){ gotoxy(10+key,6); cout<<" "; if(key<3){ key++; }else{ key=1; } gotoxy(10+key,6); cout<<">>"; }else if(k=='w'){ gotoxy(10+key,6); cout<<" "; if(key>1){ key--; }else{ key=3; } gotoxy(10+key,6); cout<<">>"; }else if(k=='k'){ rw=key; break; } gotoxy(15,16); if(key==1){ cout<<"拥有手电筒,可以晃晕监管者"; }else if(key==2){ cout<<"拥有锋利剪刀,可以剪开枷锁"; }else { cout<<"拥有针剂,可以来回复生命值"; } } } system("cls"); hang(0,0,112,'='); lie(0,1,25,'|'); lie(1,1,25,'|'); lie(70,1,24,'|'); lie(110,1,25,'|'); lie(111,1,25,'|'); hang(15,71,110,'-'); hang(25,0,112,'='); cout<<"\n"; gotoxy(26,2); if(rw==1){ cout<<"你是一名慈善家。当然,这是假的,你的真实身份是一名小偷。"; cout<<"之所以建造一座孤儿院,是因为你最喜欢的园丁小姐是个孤儿。\n"; cout<<"前几天你收到了一封来信,信上说这个庄园里有大把的金子和园丁小姐,"; cout<<"于是你来到了这里并且迷失。现在你要赶快离开这 \n"; cout<<"你看见地上有一只手电,便抓起放入口袋,抬腿迈向恐惧之源\n"; }else if(rw==2){ cout<<"你是一名园丁,患有人格分裂症。几天前你收到了一封来信,信中邀请你来这个庄园,"; cout<<"说有一位医生小姐可以治好你的病。你见到了她,她人很好,"; cout<<"你也见到了你们孤儿院的赞助商:那位慈善家。可是现在,"; cout<<"他们在哪?管不了那么多了,你现在只想在人格分裂发作之前离开这里。"; cout<<"你看到地上有一把绿化剪,你捡起别在腰间,抬腿迈向恐惧之源\n"; }else if(rw==3){ cout<<"你是一名医生。几天前你收到了一封来信,邀请你来这个庄园为一位患有"; cout<<"人格分裂的园丁小姐治病。你见到了那位园丁小姐,她非常可爱,但现在,她在哪?"; cout<<"管不了这么多了,现在你要做的是赶快离开这。"; cout<<"你瞥见地上有一支注射器和一瓶镇定剂,你拿起放入口袋中,抬腿迈向恐惧之源\n"; } gotoxy(3,72); cout<<"可用道具数:"; cout<<"\n"; gotoxy(5,72); cout<<"已破解密码机密码:"; cout<<"\n"; gotoxy(7,72); cout<<"操作方式:w 上,s 下,a 左,d右 \n"; gotoxy(9,72); cout<<"输入p暂停\n"; cout<<"\n"; return rw; } void csj(){ cout<<"门开了,你再考虑要不要回去找园丁小姐或者大把的金子。但这个念头只在\n"; Sleep(2000);