1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
#include <iostream>
#include "color.h"
#include <iomanip>
using namespace std;
using namespace Petter;
const int COL = 17;
void initBoard(char [][COL], int, int);
void printBoard(char [][COL], int, int);
void initMenu();
const int ROW = 17;
char board[ROW][COL];
struct pos
{
int x;
int y;
};
struct hunter
{
char symbol;
pos position;
char direction;
int health;
int strength;
int ammo;
int weapon;
int kills;
int food;
int death;
void initHunter();
};
void moveHunter(hunter&);
int main()
{
hunter Daryl;
Daryl.initHunter();
Daryl.health = 30;
Daryl.symbol = '@';
Daryl.position.x = 10;
Daryl.position.y = 5;
board[Daryl.position.x][Daryl.position.y] = Daryl.symbol;
initMenu();
initBoard(board, ROW, COL);
printBoard(board, ROW, COL);
return 0;
}
void initBoard(char theBoard [][COL], int row, int col)
{
for (int r = 0; r < row; r++)
{
for (int c = 0; c < col; c++)
{
theBoard[r][c] = '.';
}
}
for (int c = 0; c < COL; c++)
{
theBoard[0][c] = 205;
theBoard[row-1][c] = 205;
}
for (int r = 0; r < row; r++)
{
theBoard[r][0] = 186;
theBoard[r][col-1] = 186;
}
theBoard[0][0] = 201;
theBoard[0][col-1] = 187;
theBoard[row-1][0] = 200;
theBoard[row-1][col-1] = 188;
}
void printBoard(char theBoard [][COL], int row, int col)
{
for (int r = 0; r < row; r++)
{
for (int c = 0; c < col; c++)
{
cout << theBoard[r][c];
}
cout << endl;
}
}
void initHunter()
void initMenu()
{
cout << setw(50) << RED << "Welcome to World Z\n\n" << NORMAL;
cout << DKBLUE << "This is the beginning of the end\n";
cout << "You have entered a old school in hopes to escape the rain\n";
cout << "But little did you know, the school is swarming with\n";
cout << "something other than children\n";
cout << "Something much....much....worse...\n\n" << NORMAL;
cout << setw(45) << DKRED << setfill('~') << " " << NORMAL << setfill(' ') << endl;
cout << RED << "Here are your guidelines: \n" << NORMAL;
cout << setw(2) << DKBLUE << "1. You only have 3 moves per turn.\n";
cout << setw(2) << "2. The zombies also have 3 moves per turn.\n";
cout << setw(2) << "3. You can only move North(N), South(S), East(E), or West(W)\n";
cout << RED << "Stamina\n";
cout << setw(2) << DKBLUE << "When your stamina reaches zero, you faint\n";
cout << RED << "Weapons\n";
cout << setw(2) << DKBLUE << "You start with a rusty pistol in easy mode, and a bat in hard mode\n";
cout << setw(5) << "1. Pistol: 5 bullets; 5 damage a shot; slow reload time\n";
cout << setw(5) << "2. Bat: 4 damage per hit; **Can break after 10 hits**\n";
cout << setw(5) << "3. Sniper Rifle: 3 bullets; 8 damage per shot; very slow reload time\n";
cout << setw(5) << "4.";
cout << DKGREEN << "NOTE: You can pick up more ammo and different weapons around the school\n\n";
cout << setw(45) << DKRED << setfill('~') << " " << NORMAL << setfill(' ') << endl;
}
|