「游戏」c++岩浆逃脱 1.1

详见1.0更新内容 新增模式「职业大乱斗」#include <windows.h>#include <conio.h>#include <bits/stdc++.h>struct player{ int x; int y; int ice_time; int wrong_time; int blind_time; int repelled; int mine; bool life; in
摘要由CSDN通过智能技术生成

规则详见1.0
更新内容
 新增模式「职业大乱斗」
  当你面前有人时,可以将其击飞(定义前面为上一个动作的方向)

#include <windows.h>
#include <conio.h>
#include <bits/stdc++.h>

struct player{
   
    int x;
    int y;
    int ice_time;
    int wrong_time;
    int blind_time;
    int repelled;
    int mine;
    bool life;
    int job;
    int dir;
    int speed_time;
}a[5];

char map[201][11];

void put(char*p);

void put_map() {
   
    for(int i = -5; i <= 4; i ++) {
   
        for(int j = 1; j <= 10; j ++) {
   
            if(i == 0 && j == a[1].y) printf("○");
            else if(a[1].x + i == a[2].x && j == a[2].y) printf("●");
            else if(map[a[1].x + i][j] == 0) printf("  ");
            else if(map[a[1].x + i][j] == 1) printf("■");
            else if(map[a[1].x + i][j] == 2) printf("▓");
        }
        printf("    ");
        for(int j = 1; j <= 10; j ++) {
   
            if(i == 0 && j == a[2].y) printf("○");
            else if(a[2].x + i == a[1].x && j == a[1].y) printf("●");
            else if(map[a[2].x + i][j] == 0) printf("  ");
            else if(map[a[2].x + i][j] == 1) printf("■");
            else if(map[a[2].x + i][j] == 2) printf("▓");
        }
        puts("");
    }
    printf("玩家一 ");
    if(a[1].ice_time > clock() && a[1].wrong_time < clock()) {
   
        printf("冰冻状态         ");
    }
    else if(a[1].wrong_time > clock() && a[1].ice_time < clock()) {
   
        printf("混乱状态         ");
    }
    else if(a[1].wrong_time > clock()) {
   
        printf("混乱状态 冰冻状态");
    }
    else printf("正常状态        ");
    printf(" 玩家二 ");
    if(a[2].ice_time > clock() && a[2].wrong_time < clock()) {
   
        printf("冰冻状态         ");
    }
    else if(a[2].wrong_time > clock() && a[2].ice_time < clock()) {
   
        printf("混乱状态         ");
    }
    else if(a[2].wrong_time > clock()) {
   
        printf("混乱状态 冰冻状态");
    }
    else printf("正常状态        ");
    puts("");
    printf("技能点:%2d              技能点:%2d", a[1].mine, a[2].mine);
}

void game_one() {
   
    srand(unsigned(time(0)));
    for(int i = 1; i <= 200; i += 3) {
   
        map[i][1] = 1;
        map[i][10] = 1;
        for(int j = 2; j <= 9; j ++) {
   
            map[i][j] = 1;
        }
        if(i != 1) {
   
            map[i - 1][1] = 1;
            map[i - 1][10] = 1;
            map[i - 2][1] = 1;
            map[i - 2][10] = 1;
            for(int j = i - 2; j <= i - 1; j ++) {
   
                for(int k = 2; k <= 9; k ++) {
   
                    map[j][k] = 0;
                }
            }
            int index = rand() % 7 + 2;
            map[i][index] = 0;
            map[i][index + 1] = 0;
        }
    }
    for(int i = 1; i <= 10; i ++) {
   
        map[200][i] = 1;
    }
    a[1].x = 2;
    a[1].y = 2;
    a[2].x = 2;
    a[2].y = 2;
    a[1].ice_time = 0;
    a[1].wrong_time = 0;
    a[2].ice_time = 0;
    a[2].wrong_time = 0;
    a[1].mine = 0;
	a[1].mine = 0; 
    while(a[1].x <= 198 && a[2].x <= 198) {
   
        if(kbhit()) {
   
            char c = getch();
            if(c == -32) {
   
                c = getch();
                if(a[1].ice_time > clock()) {
   
                    ;
                }
                else if(a[1].wrong_time > clock()) {
   
                    srand(unsigned(time(0)));
                    int s = rand() % 2;
                    if(s == 0 && map[a[1].x][a[1].y - 1] != 1) -- a[1].y;
                    else if(map[a[1].x][a[1].y + 1] != 1) ++ a[1].y;
                }
                else if(c == 75 && map[a[1].x][a[1].y - 1] != 1) {
   
                    -- a[1].y;
                }
                else if(c == 77 && map[a[1].x][a[1].y + 1] != 1) {
   
                    ++ a[1].y;
                }
                else if(c == 72 && a[1].x % 3 == 0) {
   
                    a[1].x -= 2;
                }
            }
            if(c == 'a' || c == 'w' || c == 'd') {
   
                if(a[2].ice_time > clock()) {
   
                    ;
                }
                else if(a[2].wrong_time > clock()) {
   
                    srand(unsigned(time(0)));
                    int s = rand() % 2;
                    if(s == 0 && map[a[2].x][a[2].y - 1] != 1) -- a[2].y;
                    else if(map[a[2].x][a[2].y + 1] != 1) ++ a[2].y;
                }
                else if(c == 'a' && map[a[2].x][a[2].y - 1] != 1) {
   
                    -- a[2].y;
                }
                else if(c == 'd' && map[a[2].x][a[2].y + 1] != 1) {
   
                    ++ a[2].y;
                }
                else if(c == 'w' && a[2].x % 3 == 0) {
   
                    a[2].x -= 2;
                }
            }
            if(c == '0' && a[1].mine >= 1) {
   
                -- a[1].mine;
                map[a[1].x + 1][a[1].y] = 0;
            }
            if(c == '.' && a[1].mine >= 1) {
   
                -- a[1]
  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值