C++小游戏 合集

慈云数据 2024-05-28 技术支持 22 0

生化危机

#include
#include
#include
#include
#include
#include
#include
int n,round,gold=0;
bool f1,f2,f3,dead=false,PC_64Bit;
char str[4];
struct node1
{
    int hp;
    int maxhp;
    int exp;
    int atk;
    int def;
    int food;
}steve;
struct node2
{
    int hp;
    int maxhp;
    int atk;
    int def;
    int exp;
    int lev;
    int poisonous_atk;
    int poisonous_round;
    int Self_detonate_atk;
    bool nodie;
    bool poisonous;
    bool Self_detonate;
}zombie;
void help()
{
    system("cls");
    getchar();
    MessageBox(NULL,TEXT("1.下回合如果僵尸攻击你,则你不会收到中毒伤害,只会收到主伤害\n2.你不会对僵尸造成伤害\n按任意键继续"),TEXT("防毒技能"),MB_ICONINFORMATION);
    system("cls");
    return;
}
struct Quickly
{
    int Quick_speed;
    int Quick_round;
    int Quick_zombie;
}Quick;
void SetColor(unsigned short ForeColor,unsigned short BackGroundColor)
{
    HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hCon,(ForeColor%16)|(BackGroundColor%16*16));
}
void ERR_1()
{
    MessageBox(NULL,TEXT("ERR1:金币不足!"),TEXT("ERROR"),MB_ICONWARNING);
    return;
}
bool Bit64()
{
    if(sizeof(void*)==4) return false;
    else if(sizeof(void*)==8) return true;
    return false; 
}
void Level_1()
{
    steve.atk=10;
    steve.hp=50;
    steve.maxhp=50;
    steve.exp=0;
    steve.def=1;
    system("cls");
    printf("第一章 起源");
    Sleep(2000);
    system("cls");
    getchar();//生化危机1.0修复 
    printf("8月21日,你出差到H市回来,感觉哪里都是空荡荡的");
    getchar();
    system("cls");
    printf("你坐上去往公司的地铁,却发现地铁里没有人(反科学,地铁会自动开动)");
    getchar();
    system("cls");
    printf("早上7:00,地铁里空荡荡的,但在平时,地铁上几乎是人挤人");
    getchar();
    system("cls");
    printf("你:真奇怪,为什么今天地铁上没有人?");
    getchar();
    system("cls");
    printf("8:00,你进了公司,发现里面根本就没人,并且公司漆黑一片");
    getchar();
    system("cls");
    printf("你借着手机屏幕的亮光找到了电梯,并找到了你的办公室");
    getchar();
    system("cls");
    printf("你:咋真么黑还没有人开灯啊");
    getchar();
    system("cls");
    printf("你(大喊):有人吗!有人倒是说句话啊!");
    getchar();
    system("cls");
    printf("然而,走廊空空荡荡的,没有一个人");
    getchar();
    system("cls");
    printf("你:哎,还是先把灯打开,在想办法吧");
    getchar();
    system("cls");
    printf("按下开关,走廊的灯眨眼间亮了");
    getchar();
    system("cls");
    printf("忽然,一只手搭在了你的背后!");
    getchar();
    system("cls");
    printf("你:啊!你是什么人!别过来!");
    getchar();
    system("cls");
    printf("呃~~~~~~");
    getchar();
    system("cls");
    printf("按任意键开始战斗");
    getchar();
    zombie.hp=30;
    zombie.atk=6;
    zombie.def=0;
    zombie.exp=8;
    zombie.lev=1;
    zombie.nodie=true;
    system("cls");
    printf("敌人信息:\n");
    printf("敌人:普通僵尸    等级:%d\n",zombie.lev);
    printf("血量:%d    伤害:%d    防御:%d    击杀可获得%d经验\n",zombie.hp,zombie.atk,zombie.def,zombie.exp);
    Sleep(4000);
    system("cls");
    while(steve.hp>;0 && zombie.hp>0)
    {
        printf("敌人:普通僵尸 等级%d\n",zombie.lev);
        printf("你的血量:%d    僵尸血量:%d\n",steve.hp,zombie.hp);
        printf("武器:\n");
        printf("1| 普通攻击 10伤害 攻速1\n");
        scanf("%d",&n);
        if(n==1)
        {
            printf("你对僵尸造成了%d伤害\n",steve.atk-zombie.def);
            zombie.hp=zombie.hp-(steve.atk-zombie.def);
        }
        else printf("无效输入\n");
        Sleep(1000);
        if(zombie.hp
微信扫一扫加客服

微信扫一扫加客服

点击启动AI问答
Draggable Icon