自制C++游戏《袁坤》0.9版本

        刚来CSDN没多久。前几天我自己制作了一个游戏,想着在这里发一下,时不时会更新一些功能,然后还会发出来。那么也是废话不多说,不多说废话,直接上链接,啊呸,是上代码。

#include <iostream>
#include <bits/stdc++.h>
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <stdlib.h>
using namespace std;
char a[6];
int main(){
    int L=1,life=100,dlife=100,J=1,s=1000;
    cout<<"========================================="<<endl<<endl;
    cout<<"                    袁坤"<<endl<<"                   0.9版本"<<endl;
    Sleep(2000);
    system("cls");
    
    cout<<"========================================="<<endl<<endl;
    cout<<"         抵制不良游戏,拒绝盗版游戏。"<<endl;
    cout<<"         注意自我保护,谨防受骗上当。"<<endl;
    cout<<"         适度游戏益脑,沉迷游戏伤身。"<<endl;
    cout<<"         合理安排时间,享受健康生活。"<<endl<<endl;
    cout<<"              初始化资源中..."<<endl;
    int n=20;
    cout<<"            _____________________"<<endl;
    cout<<"            ";
    while(n--){
        cout<<"█";
        Sleep(300);
    }
    system("cls");
//====================================================         
    cout<<"========================================="<<endl<<endl;
    cout<<"         抵制不良游戏,拒绝盗版游戏。"<<endl;
    cout<<"         注意自我保护,谨防受骗上当。"<<endl;
    cout<<"         适度游戏益脑,沉迷游戏伤身。"<<endl;
    cout<<"         合理安排时间,享受健康生活。"<<endl<<endl;
    cout<<"             加载客户端数据中..." <<endl;
    n=20;
    cout<<"            _____________________"<<endl;
    cout<<"            ";
    while(n--){
        cout<<"█";
        Sleep(300);
    }
    system("cls");
//====================================================         
    cout<<"========================================="<<endl<<endl;
    cout<<"    欢迎来到坤瓦特大陆,rap者,请问你叫什"<<endl;
    cout<<"么名字?"<<endl;
    cout<<"请输入你的名字(仅限英文、符号,6个字符):"<<endl;
    for(int i=0;i<6;i++){
        cin>>a[i];
    }
    cout<<"    "<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]<<a[5];
    cout<<",这是你的坤瓦特通行证,"<<endl;
    cout<<"有了它,你就能通行坤瓦特大部分地区了。"<<endl;
    Sleep(2000);
     system("cls");
//====================================================     
    char x; 
    cout<<"选择要做的事情:(输入对应的序号)"<<endl;
        cout<<"A.移动  B.购买  C.出售  D.查看物品 E.探索"<<endl;
        cout<<"F.关于  G.退出"<<endl;
    while(cin>>x){
        life=100;
        dlife=100;
        if(x=='A'){//移动 
            system("cls");
            cout<<"========================================="<<endl;
            cout<<"选择要去的地方:"<<endl;
            cout<<"A.饭店  B.手机店  C.野外  D.家"<<endl;
            cin>>x;
            system("cls");
            if(x=='A'){//饭店 
                system("cls");
                cout<<"========================================="<<endl;
                cout<<"饭店正在装修,敬请期待。"<<endl;
                Sleep(1000); 
                system("cls");
            } else if(x=='B'){//手机店 
                cout<<"========================================="<<endl;
                cout<<"请问您要买什么手机?"<<endl;
                cout<<"A.小米($1000)  B.苹果($1500)"<<endl;
                cout<<"C.华为($1550)  D.离开"<<endl;
                cin>>x; 
                if(x=='A'){//小米 
                    if(s>=1000){
                        cout<<"恭喜您喜提新机!"<<endl; 
                    }else{
                        cout<<"余额不足!"<<endl;
                    }
                } 
                if(x=='B'){//苹果 
                    if(s>=1500){
                        cout<<"恭喜您喜提新机!"<<endl; 
                    }else{
                        cout<<"余额不足!"<<endl;
                    }
                } 
                if(x=='C'){//华为 
                    if(s>=1550){
                        cout<<"恭喜您喜提新机!"<<endl; 
                    }else{
                        cout<<"余额不足!"<<endl;
                    }
                } 
                Sleep(1000); 
                system("cls");
            }else if(x=='C'){//野外
                system("cls");
                cout<<"========================================="<<endl;
                cout<<"一只野生坤坤向你扑了过来!"<<endl;
                while(dlife>0){
                    if(life>0){
                        cout<<"你反击,坤坤血量-50。"<<endl;
                        dlife-=50;    
                        Sleep(500);
                    }
                    if(dlife>0){
                        cout<<"坤坤攻击,你的血量-10。"<<endl;
                        life-=10; 
                        Sleep(500);
                    }
                    if(dlife<=0){
                        cout<<"坤坤被击败,你的等级+2。"<<endl;
                        L+=2;
                        break;
                    }    
                }
            }else if(x=='D'){//家 
            cout<<"========================================="<<endl;
                cout<<"请选择要做的事情:"<<endl;
                cout<<"A.吃饭  B.睡觉"<<endl;
                cin>>x;
                if(x=='A'){
                    Sleep(3000);
                    cout<<"吃完了"<<endl; 
                } else if(x=='B'){
                    Sleep(5000);
                    cout<<"睡醒了"<<endl; 
                }
                Sleep(1000); 
                system("cls");
            }
        }else if(x=='B'){
                system("cls");
                cout<<"========================================="<<endl;
            cout<<"此功能正在开发中,敬请期待。"<<endl; 
            Sleep(1000); 
                system("cls");
        }else if(x=='C'){
                system("cls");
                cout<<"========================================="<<endl;
            cout<<"此功能正在开发中,敬请期待。"<<endl; Sleep(1000); 
                system("cls");
        } else if(x=='D'){
                system("cls");
                cout<<"========================================="<<endl;
            cout<<"此功能需等“购买”“出售等功能开发后开发,敬请期待。"<<endl;Sleep(1000); 
                system("cls"); 
        }else if(x=='F'){
                system("cls");
            cout<<"========================================="<<endl<<endl;
            cout<<"    关于此游戏:"<<endl;
            cout<<"    《袁坤》是一款由原神启动(袁*杰)制作"<<endl; 
            cout<<"的C++小游戏,在游戏中,玩家将扮演一名rap"<<endl;
            cout<<"者,探索坤瓦特大陆。"<<endl;
            cout<<"                     更新于2023年11月23日"<<endl<<endl;
            cout<<"(按任意键继续)"<<endl;
            cin>>x; 
                system("cls");
        } else if(x=='E'){
                system("cls");
                cout<<"========================================="<<endl;
            cout<<"此功能正在开发中,敬请期待。"<<endl; Sleep(1000); 
                system("cls");
        }else if(x=='G'){
            cout<<"========================================="<<endl<<endl<<endl<<endl;
            cout<<"                正在退出..."<<endl;
             int n=20;
            cout<<"          _____________________"<<endl;
            cout<<"          ";
            while(n--){
            cout<<"█";
            Sleep(300);
            }
            return 0;    
        } 
        cout<<"========================================="<<endl;
        cout<<"选择要做的事情:(输入对应的序号)"<<endl;
        cout<<"A.移动  B.购买  C.出售  D.查看物品 E.探索"<<endl;
        cout<<"F.关于  G.退出"<<endl;
    }    
}

好的这就是《袁坤》的所有代码了,想要实时掌握本游戏动态,那就关注我,如果更新我会发出来。

(若需转载请标明原作者)

  • 8
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值