自创的小游戏

自创的小游戏自创的小游戏 上周末没什么事情 于是写了一个游戏

自创的小游戏

 上周末没什么事情,于是写了一个游戏。听我爸说这种游戏他小时候玩过。 
#include<bits/stdc++.h> #include<conio.h>  using namespace std; int main() { 
    cout<<"|---------------|\n"; cout<<"|游戏说明: |\n"; cout<<"|1.按a键表示向左|\n"; cout<<"|2.按d键表示向右|\n"; cout<<"|3.当分数大于50 |\n"; cout<<"|时,可以按空格 |\n"; cout<<"|键将两个球推到 |\n"; cout<<"|上面去(放大招) |\n"; cout<<"|4.按f键表示退出|\n"; cout<<"|游戏 |\n"; cout<<"|5.躲过一个球得1|\n"; cout<<"|分,被球砸到扣5|\n"; cout<<"|分,放一个大招 |\n"; cout<<"|扣50分 |\n"; cout<<"|6.每轮游戏的初 |\n"; cout<<"|始分数为5分。 |\n"; cout<<"|---------------|"; for(int i=0;i<;i++) { 
    //do nothing; } int ch; int a=9,b=0; srand(time(0)); int time=5; int gk=1; while(1) { 
    system("cls"); cout<<endl; int nowzx,nowzy; int nowhx,nowhy; nowzx=rand()%10; nowzy=rand()%10; nowhx=rand()%10; nowhy=rand()%10; for(int i=0;i<100;i++) { 
    if(time>=200) { 
    system("cls"); cout<<"第"<<gk+1<<"关!"; for(int i=0;i<;i++) { 
    //do nothing;  } gk++; time=5; } int flag=0; if(_kbhit()) { 
    ch=_getch(); if(ch=='a'&&b>0) b--; else if(ch=='d'&&b<10) b++; else if(ch==' '&&time>50) { 
    nowzx=-(rand()%5); nowhx=-(rand()%5); time-=50; } else if(ch=='f') { 
    cout<<"本轮游戏分数为:"<<time<<endl; return 0; } } nowzx++; nowhx++; if(nowzx>=10) { 
    nowzx=0; nowzy=b; time++; } if(nowhx>=10-rand()%6+3) { 
    nowhx=0; nowhy=b; time++; } if(nowzx==a&&nowzy==b||nowhx==a&&nowhy==b) { 
    time-=5; } cout<<"|"; for(int i=0;i<=9;i++)cout<<"-"; cout<<"|\n"; for(int i=0;i<10;i++) { 
    cout<<"|"; for(int j=0;j<10;j++) { 
    if(i==a&&j==b) { 
    cout<<"&"; } else if(i==nowzx&&j==nowzy||i==nowhx&&j==nowhy) { 
    cout<<"*"; } else { 
    cout<<" "; } } cout<<"|"; cout<<endl; } cout<<"|"; for(int i=0;i<=9;i++)cout<<"-"; cout<<"|\n"; cout<<"玩到了第"<<gk<<"关\n"; cout<<"当前分数为:"<<time<<endl; for(int i=0;i<-time*-gk*;i++) { 
    //do nothing; } cout<<endl; system("cls"); } cout<<endl; } return 0; } 
今天的文章 自创的小游戏分享到此就结束了,感谢您的阅读。
编程小号
上一篇 2024-12-05 13:17
下一篇 2024-12-05 13:11

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/bian-cheng-ji-chu/78615.html