I am working on a game kind of like chess but with only 1 piece per a player.
In the beginning they pick there stats(movement, HP, damage, and range of weapons). 10 pts to put where ever they like ranging from 1-6 per a stat
When hit hp is reduced by damage done. So i supose a for loop would be good for that as well
Weapons is how much +damage the weapons do
it is a 10 x 10 grid that i will use ascii. Yet I dont really get how you draw with ascii. Porbably an array i believe.
My game system im using will be based off of x, y. 0,0 top left 10,10 bottom right.
The M.I.M.E's (mechines in main engagement) as i call them can only shoot or move in the direction they are facing. So i was doing to use:
Q- rotate counter-clockwise
W- move forward
E- rotate clockwise
I was thinking maybe using a switch statement like
cout << "Enter a movemement. You have " << move << "moves left." <<endl;
cin >> choice;
switch(choice)
{
case 1://rotate counter-clockwise
case 2:// move forward
case 3: //rotate clockwise
default: // loop back around
}
Any action counts as a move. So i will use a for loop to acount of that part. for( int i= 0; i > move; i++)
What i do not understand is how do you move the MIME's across the field =/
as for weapons i was going to find a way to check the x,y cord of the other robot.
However i wanted to use two different weapons, a laser and a grenade.
Laser shoots straight based off of range 3-4 damage
and grenade is range -1 and does a 3x3 kill grid dealing 1-2 damage
At first the robot moves randomly around until he is "Within range" i was going to make his range based off his firing range of range+1 x range.
Extras!!!!:
These are things i really would kill to do but is not something i need.
LANDMINES!: place a mine at x,y when player is in the 4x4 box of the mine it goes boom dealing 1 damage
Saving the game file: Not a clue how to do this
Pillars/Block on the ground: i would guess a random Num generator 2 place the blocks maybe 2-4 then randoms 0-10,0-10.
Any help or a direction to a website about basic 2D game design would be much love. This is huge jump in what we have been doing in class which is basic user input so i am completely lost :(
7 1751
What I would do is to just write everything down, and take it one step at a time. First, generate and draw the field, then introduce the human player. Get some input, and move the player around. Introduce weapons, and make sure you can shoot at stationary things correctly. The last thing you should do is to introduce the AI, because it will be difficult, unless you just want it to move around randomly and shoot randomly.
Remember, one step at a time.
good luck.
P.S. If you have any specific questions, you are welcome to ask.
P.P.S. Searching for "game development tutorials" in google yields quite a few results that seem good.
Every google search i tried yeilded bad results. Most were about tic-tac-toe. Non dealt with using ascii to draw and board and play on it from user input.
:( could you offer a link or a book that would b good for this topic. I already tried 1 book but again it was about user input and displaying data nothing about a board playing field
I don't know any good references off the top of my head. This shouldn't be a difficult problem. To display a field (that is stored in an array), you just need two loops. At each iteration, you can check if that position corresponds with the player or the AI. If it does, then instead of drawing the field, you draw the symbol representing the player (or the AI). Likewise for various laser/grenades/mines, except you will want to keep those in an array (or some other container) and associate a "lifetime" with it. For instance, say a grenade explodes after 2 turns, then it has a lifetime of two, and whenever it reaches 0 it explodes. Mines have an infinite lifetime, until someone steps of them.
So, just think it through in this manner and start coding one step at a time: draw the field first, draw the characters, make the characters move, etc. When you get further in and start getting stuck, you can ask more questions here.
Again, any kind of reference isn't going to be tailored to your game. It's just going to be about _some_ game. But you learn from these references, nevertheless.
good luck
I've been banging my head against a wall but i've made progress!
I'm stuck at these points:
1) making the robot move at random when the player is in range engage them.
2) checking to see if the weapons hit(grenade/laser) I'm guessing checking player positon with the X,Y for grenade and X or Y for laser.
3)Displaying the ascii grid
4) Player = ascii 193- North 194-South 195- East 180- West. How do i display so they rotate as the player changes direct? I was guessing a IF loop.
5) same for the Computer as number 4
6)Randoming the stats for the robot so they = 10 and do not go over, but can go under.
7) Laser i was going to use '.' for the laser or ascii #220. How can i display so i shoots across the map
8)Grenade- was going to use ascii 177 to show the area the grenade hit in.
*not needed but i would also like 2 try and drop random walls*
Any help or other problems you see i will love you for LIFE! -
#include <cstdlib>
-
#include <iostream>
-
#include "color.h"
-
#include <conio.h>
-
-
using namespace std;
-
using namespace Petter;
-
-
void title();
-
void credits();
-
void intro();
-
void instructions();
-
int menu(char arrayGrid[][21]);
-
void displayGrid(char arrayGrid[][21]);
-
void begin();
-
void yourTank();
-
void yourTankRotate();
-
void compTank();
-
void compTankRotate();
-
void stats();
-
void compStats();
-
void shootL();
-
void shootG();
-
void shieldLeft();
-
void move();
-
void hit();
-
void direction();
-
-
-
-
int main(int argc, char *argv[])
-
{
-
//yourTank;
-
//compTank;
-
-
//yourTankY =2;
-
//yourTankX = 2;
-
//compTankY = 19;
-
//compTankX = 19;
-
-
char arrayGrid[21][21]={
-
{201,205,209,205,209,205,209,205,209,205,209,205,209,205,209,205,209,205,209,205,187},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{200,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,188},
-
};
-
-
-
title();
-
credits();
-
cout << endl;
-
cout << endl;
-
menu(arrayGrid);
-
-
-
system("PAUSE");
-
return EXIT_SUCCESS;
-
}
-
void title()
-
{
-
cout << endl;
-
cout << endl;
-
cout << endl;
-
cout << endl;
-
cout << "\t\t\t" <<RED << " WELCOME TO M.I.M.E WARS!!!!!!!" << NORMAL << endl;
-
}
-
void credits()
-
{
-
cout << endl;
-
cout << endl;
-
cout << endl;
-
cout << endl;
-
cout << "\t\t\tCreated by: Michael Meyer" << endl;
-
cout << "\t\t\tWith Help from: Mountain Dew" << endl;
-
}
-
int menu(char arrayGrid[][21])
-
{
-
char choice;
-
-
do
-
{
-
-
-
cout << " :[b]ATTLE!: " <<endl;
-
cout << " " <<endl;
-
cout << " :[S]tory Line:" <<endl;
-
cout << " " <<endl;
-
cout << " :[i]NSTRUCTIONS:" <<endl;
-
cout << " " <<endl;
-
cout << " :[E]xit(chicken!?): " <<endl;
-
-
choice =getch(); // calls for input
-
switch(choice)
-
{
-
case 'b':
-
{
-
begin();
-
}
-
break;
-
case 's':
-
{
-
intro();
-
}
-
break;
-
case 'i':
-
{
-
instructions();
-
}
-
break;
-
case 'e':
-
break;
-
}
-
}
-
while(choice != 'e');
-
-
return 0;
-
}
-
-
void instructions();
-
{
-
cout << "\t\t\t\t Instructions" << endl << endl << endl;
-
-
cout << "Player controls:" << endl;
-
cout << "W key: Progress the M.I.M.E forward, towards the way they are facing." << endl;
-
cout << "A key: Rotates the M.I.M.E left." << endl;
-
cout << "D key: Rotatest the M.I.M.E Counter right." << endl;
-
cout << "E key: Chooses to fire the M.I.M.E's Lazer." << endl;
-
cout << "Q key: Chooses to lob a M.I.M.E's Grenade." << endl;
-
}
-
void into();
-
{
-
cout << "\t\t\t\t Introduction" << endl << endl << endl;
-
cout << "\tDuring the third World War a new breed of warefare was brought to life. M.I.M.E's were born to be a slave of men.";
-
Sleep(4000);
-
cout << " M.I.M.E, Mechines In Main Engagement, were a far more advance design of A.I.(Artificial Intelegence).";
-
Sleep(4000);
-
cout << "There mechines were designed to lower human casualties, but instead turned and increase the death toll.";
-
cout << endl;
-
Sleep(4000);
-
cout << "\tWhen the M.I.M.Es turned, it was nothing more then a silent killing of those around them.";
-
Sleep(4000);
-
cout << "Man was once again forced back into traditional warfare of opertaing there own mechines and demise.";
-
cout << endl;
-
cout << endl;
-
cout << endl;
-
Sleep(4000);
-
cout << "Who will win!?!?.........";
-
cout << endl;
-
cout << endl;
-
}
-
-
void displayGrid(char arrayGrid[][21] // display the grid + robots
-
{
-
-
}
-
void yourTank(); // your tank Green
-
{
-
-
}
-
-
void yourTankRotate(); // Shows you tank rotating N, S, W, E
-
{
-
-
}
-
-
void compTank(); // computer tank Red
-
{
-
-
}
-
-
void compTankRotate(); // Shows computer tank rotating N, S, W, E
-
{
-
-
}
-
-
void stats();
-
{
-
int shield; // HP
-
int move; // actions per a round
-
int weapon; // +damage
-
int range; // how far your weapon shoots
-
int total = range + shield + weapon + move; // total stats cannot acceed 10
-
int remaining = 10 - range + shield + weapon + move;
-
-
cout << "Choose the stats you would like for your M.I.M.E., with a max total of 10." << endl;
-
-
while(total != 10)
-
{
-
cout << "Choose 1-6 for your range of your weapon(" << remaining << " points left: ";
-
cin >> range;
-
while((cin == 0) || (range < 0))
-
{
-
cin.clear();
-
cin.ignore(10000, '\n');
-
cout << "Please enter the amount of range: ";
-
cin >> range;
-
}
-
-
cout << "Choose 1-6 for your shields(" << remaining << " points left: ";
-
cin >> shield;
-
while((cin == 0) || (shield < 0))
-
{
-
cin.clear();
-
cin.ignore(10000, '\n');
-
cout << "Please enter amount for the shield: ";
-
cin >> shiel;
-
}
-
-
cout << "Choose 1-6 for your weapon damage(" << remaining << " points left: ";
-
cin >> weapon;
-
while((cin == 0) || (weapon < 0))
-
{
-
cin.clear();
-
cin.ignore(10000, '\n');
-
cout << "Please enter the amount for the weapon: ";
-
cin >> weapon;
-
}
-
-
cout << "Choose 1-6 for your movement speed(" << remaining << " points left: ";
-
cin >> move;
-
while((cin == 0) || (move < 0))
-
{
-
cin.clear();
-
cin.ignore(10000, '\n');
-
cout << "Please enter the amount for movement: ";
-
cin >> move;
-
}
-
}
-
}
-
-
void compStats(); // stats MUST be random 1-6 cannot accede 10 total
-
{
-
srand(time(0)); // int random number
-
int shield; // HP
-
int move; // actions per a turn
-
int weapon; // +damage
-
int range; // how far weapon can shoot
-
int total = range + shield + weapon + move;
-
-
cout << "The computers stats are as shown: " << endl
-
-
while(total != 10 )
-
{
-
range = (rand(0) % 6);
-
shield = (rand(0) % 6);
-
weapon = (rand(0) % 6);
-
move = (rand(0) % 6);
-
}
-
-
cout << "Range is = " << range << endl;
-
cout << "Shield is = " << shield << endl;
-
cout << "Weapon is = " << weapon << endl;
-
cout << "Movement is = " << move << endl;
-
}
-
-
void shootL(); // direct shot 2 damage
-
{
-
-
}
-
-
void shootG(); // Area of affect dmg 3x3 1 dmg
-
{
-
-
}
-
-
void shieldLeft(); // remaining life points
-
{
-
int yourShield;
-
int compShield;
-
-
cout << "Your shield left is: " << yourShield << endl;
-
-
cout << "The computers shield left is: " << compShield << endl;
-
}
-
-
void direction(); // which direction you are facing to determine which way you can move
-
{ // face must remain 1-4
-
int face = 1;
-
char direction;
-
-
if( face = 1)
-
{
-
direction = "North";
-
}
-
else if(face = 2)
-
{
-
direction = "West";
-
}
-
else if(face = 3)
-
{
-
direction = "South";
-
}
-
else(face = 4)
-
{
-
direction = "East"
-
}
-
cout << "You are facing: " << direction << endl;
-
}
-
-
void move(); // Move you forward
-
{
-
int choice;
-
int moveX;
-
int moveY;
-
-
cout << "Choose a movement command." << endl;
-
cin >> choice
-
-
switch(choice)
-
{
-
case w: // move forward adding 1 to X or Y axis based on direction facing
-
while(x != 0 && x != 21 && y != 0 && y != 21)
-
{
-
if(int face = 2 || face = 4)
-
{
-
yourTankX + 1 = moveX;
-
}
-
else(int face = 1 || face = 3)
-
{
-
yourTankY + 1 = moveY;
-
}
-
}
-
-
case a: // rotates you to the left subtracting 1 from face
-
-
-
case d: // rotates you to the right adding 1 to face
-
-
-
case e: // fires THE LAZER!
-
hit();
-
-
case q: // Lobs the grenade
-
hit();
-
}
-
}
-
-
void hit() // determines if the weapons hit
-
{
-
-
}
-
-
Your code doesn't compile: I see a lot of functions that go like this:
Leave out that semi colon.
kind regards,
Jos
i've managed to get most my functions done. I'm not to sure on how to display the grid array so i can refresh the screen each time a robot moves.
If you see any other problems please let me know, this is my first multi function assignment =/ -
#include <cstdlib>
-
#include <iostream>
-
#include "color.h"
-
#include <conio.h>
-
-
using namespace std;
-
using namespace Petter;
-
-
void title();
-
void credits();
-
void intro();
-
void instructions();
-
int menu(char arrayGrid[][21]);
-
void displayGrid(char arrayGrid[][21]);
-
void begin();
-
void yourTank();
-
void yourTankRotate();
-
void compTank();
-
void compTankRotate();
-
void stats();
-
void compStats();
-
void yourShootL();
-
void compShootL();
-
void shootG();
-
void shieldLeft();
-
void move();
-
void hitLaser();
-
void hitGrenade();
-
void direction();
-
void tankFace();
-
-
-
-
int main(int argc, char *argv[])
-
{
-
//yourTank;
-
//compTank;
-
-
//yourTankY =2;
-
//yourTankX = 2;
-
//compTankY = 19;
-
//compTankX = 19;
-
//int compShield; // HP
-
//int compMove; // actions per a turn
-
//int compWeapon; // +damage
-
//int compRange; // how far weapon can shoot
-
//int compTotal = compRange + compShield + compWeapon + compMove;
-
//int yourShield;// HP
-
//int yourMove; // actions per a round
-
//int yourWeapon; // +damage
-
//int yourRange; // how far your weapon shoots
-
//int yourTotal = yourRange + yourShield + yourWeapon + yourMove; // total stats cannot acceed 10
-
//int yourRemaining = 10 - yourRange + yourShield + yourWeapon + yourMove;
-
//int yourFace;
-
//char action;
-
char arrayGrid[][21]={
-
{201,205,209,205,209,205,209,205,209,205,209,205,209,205,209,205,209,205,209,205,187},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{200,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,188},
-
};
-
-
-
title();
-
credits();
-
cout << endl;
-
cout << endl;
-
menu(arrayGrid);
-
-
-
system("PAUSE");
-
return EXIT_SUCCESS;
-
}
-
void title()
-
{
-
cout << endl;
-
cout << endl;
-
cout << endl;
-
cout << endl;
-
cout << "\t\t\t" <<RED << " WELCOME TO M.I.M.E WARS!!!!!!!" << NORMAL << endl;
-
}
-
void credits()
-
{
-
cout << endl;
-
cout << endl;
-
cout << endl;
-
cout << endl;
-
cout << "\t\t\tCreated by: Michael Meyer" << endl;
-
cout << "\t\t\tWith Help from: Mountain Dew" << endl;
-
}
-
int menu(char arrayGrid[][21])
-
{
-
char choice;
-
-
do
-
{
-
-
-
cout << " :[b]ATTLE!: " <<endl;
-
cout << " " <<endl;
-
cout << " :[S]STORY LINE:" <<endl;
-
cout << " " <<endl;
-
cout << " :[i]NSTRUCTIONS:" <<endl;
-
cout << " " <<endl;
-
cout << " :[E]XIT(chicken!?): " <<endl;
-
-
choice =getch(); // calls for input
-
switch(choice)
-
{
-
case 'b':
-
{
-
begin();
-
}
-
break;
-
case 's':
-
{
-
intro();
-
}
-
break;
-
case 'i':
-
{
-
instructions();
-
}
-
break;
-
case 'e':
-
break;
-
}
-
}
-
while(choice != 'e');
-
-
return 0;
-
}
-
-
void instructions()
-
{
-
cout << "\t\t\t\t Instructions" << endl << endl << endl;
-
-
cout << "Player controls:" << endl;
-
cout << "W key: Progress the M.I.M.E forward, towards the way they are facing." << endl;
-
cout << "A key: Rotates the M.I.M.E left." << endl;
-
cout << "D key: Rotatest the M.I.M.E Counter right." << endl;
-
cout << "E key: Chooses to fire the M.I.M.E's Lazer." << endl;
-
cout << "Q key: Chooses to lob a M.I.M.E's Grenade." << endl;
-
}
-
void into()
-
{
-
cout << "\t\t\t\t Introduction" << endl << endl << endl;
-
cout << "\tDuring the third World War a new breed of warefare was brought to life. M.I.M.E's were born to be a slave of men.";
-
Sleep(4000);
-
cout << " M.I.M.E, Mechines In Main Engagement, were a far more advance design of A.I.(Artificial Intelegence).";
-
Sleep(4000);
-
cout << "There mechines were designed to lower human casualties, but instead turned and increase the death toll.";
-
cout << endl;
-
Sleep(4000);
-
cout << "\tWhen the M.I.M.Es turned, it was nothing more then a silent killing of those around them.";
-
Sleep(4000);
-
cout << "Man was once again forced back into traditional warfare of opertaing there own mechines and demise.";
-
cout << endl;
-
cout << endl;
-
cout << endl;
-
Sleep(4000);
-
cout << "Who will win!?!?.........";
-
cout << endl;
-
cout << endl;
-
}
-
-
void begin(char arrayGrid[][21])
-
{
-
stats();
-
//displayGrid(arrayGrid[][21]);
-
cout << endl;
-
shieldLeft();
-
cout << endl;
-
direction();
-
cout << endl;
-
cout << endl;
-
move();
-
}
-
void displayGrid(char arrayGrid[][21]) // display the grid + robots
-
{
-
cout << (char) {201,205,209,205,209,205,209,205,209,205,209,205,209,205,209,205,209,205,209,205,187},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{199,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,182},
-
{186,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',179,' ',186},
-
{200,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,207,205,188},
-
};
-
}
-
void yourTank() // your tank Green
-
{
-
-
}
-
-
/*void yourTankRotate() // Shows you tank rotating N, S, W, E
-
{
-
if(action == a)
-
{
-
yourFace - 1;
-
-
}
-
else if(action == d)
-
{
-
yourFace - 1;
-
}
-
//yourTankFace();
-
}
-
*/
-
void compTank() // computer tank Red
-
{
-
-
}
-
-
void compTankRotate() // Shows computer tank rotating N, S, W, E
-
{
-
-
}
-
-
void stats()
-
{
-
int yourShield; // HP
-
int yourMove; // actions per a round
-
int yourWeapon; // +damage
-
int yourRange; // how far your weapon shoots
-
int yourTotal = yourRange + yourShield + yourWeapon + yourMove; // total stats cannot acceed 10
-
int yourRemaining = 10 - yourRange + yourShield + yourWeapon + yourMove;
-
-
cout << "Choose the stats you would like for your M.I.M.E., with a max total of 10." << endl;
-
-
while(yourTotal != 10)
-
{
-
cout << "Choose 1-6 for your range of your weapon(" << yourRemaining << " points left: ";
-
cin >> yourRange;
-
while((cin == 0) || (yourRange < 0))
-
{
-
cin.clear();
-
cin.ignore(10000, '\n');
-
cout << "Please enter the amount of range: ";
-
cin >> yourRange;
-
}
-
-
cout << "Choose 1-6 for your shields(" << yourRemaining << " points left: ";
-
cin >> yourShield;
-
while((cin == 0) || (yourShield < 0))
-
{
-
cin.clear();
-
cin.ignore(10000, '\n');
-
cout << "Please enter amount for the shield: ";
-
cin >> yourShield;
-
}
-
-
cout << "Choose 1-6 for your weapon damage(" << yourRemaining << " points left: ";
-
cin >> yourWeapon;
-
while((cin == 0) || (yourWeapon < 0))
-
{
-
cin.clear();
-
cin.ignore(10000, '\n');
-
cout << "Please enter the amount for the weapon: ";
-
cin >> yourWeapon;
-
}
-
-
cout << "Choose 1-6 for your movement speed(" << yourRemaining << " points left: ";
-
cin >> yourMove;
-
while((cin == 0) || (yourMove < 0))
-
{
-
cin.clear();
-
cin.ignore(10000, '\n');
-
cout << "Please enter the amount for movement: ";
-
cin >> yourMove;
-
}
-
}
-
}
-
-
void compStats() // stats MUST be random 1-6 cannot accede 10 total
-
{
-
srand(time(0)); // int random number
-
int total = 0;
-
int compRange;
-
int compShield;
-
int compWeapon;
-
int compMove;
-
-
cout << "The computers stats are as shown: " << endl;
-
-
while(total != 10 )
-
{
-
compRange = (rand() % 6) + 1;
-
total = compRange - 10;
-
compShield = (rand() % 6) + 1;
-
total = (compShield + compRange) - 10;
-
compWeapon = (rand() % 6) + 1;
-
total =(compShield + compRange + compWeapon) - 10;
-
compMove = (rand() % 6) + 1;
-
total =(compShield + compRange + compRange + compMove) - 10;
-
}
-
-
cout << "Range is = " << compRange << endl;
-
cout << "Shield is = " << compShield << endl;
-
cout << "Weapon is = " << compWeapon << endl;
-
cout << "Movement is = " << compMove << endl;
-
}
-
-
-
void yourShootL() // direct shot 2 damage
-
{
-
int face;
-
int yourTankX;
-
int yourRange;
-
int weaponX;
-
int yourTankY;
-
int weaponY;
-
-
if( 2 == face || 4 == face)
-
{
-
weaponX = yourTankX + yourRange;
-
}
-
else if( 1 == face || 3 == face)
-
{
-
weaponY = yourTankY + yourRange;
-
}
-
-
-
-
hitLaser();
-
}
-
-
void compShootL() // direct shot 2 damage
-
{
-
int face;
-
int compTankY;
-
int compTankX;
-
int weaponX;
-
int weaponY;
-
int compRange;
-
-
if( 2 == face || 4 == face)
-
{
-
weaponX = compTankX + compRange;
-
}
-
else if ( 1 == face || 3 == face)
-
{
-
weaponY = compTankY + compRange;
-
}
-
-
-
-
hitLaser();
-
}
-
-
void shootG() // Area of affect dmg 3x3 1 dmg
-
{
-
int face;
-
int yourTankX;
-
int yourRange;
-
int weaponX;
-
int yourTankY;
-
int weaponY;
-
-
if( 2 == face || 4 == face)
-
{
-
weaponX = yourTankX + yourRange;
-
}
-
else if( 1 == face || 3 == face)
-
{
-
weaponY = yourTankY + yourRange;
-
}
-
-
hitGrenade();
-
}
-
-
void shieldLeft() // remaining life points
-
{
-
int yourShield;
-
int compShield;
-
-
cout << "Your shield left is: " << yourShield << endl;
-
-
cout << "The computers shield left is: " << compShield << endl;
-
}
-
-
void direction() // which direction you are facing to determine which way you can move
-
{ // face must remain 1-4
-
int yourFace;
-
-
if( yourFace == 1)
-
{
-
cout << "You are facing North" ;
-
}
-
else if(yourFace == 2)
-
{
-
cout << "You are facing West";
-
}
-
else if(yourFace == 3)
-
{
-
cout << "You are facing South";
-
}
-
else if(yourFace == 4)
-
{
-
cout << "You are facing East";
-
}
-
else if( yourFace > 4 || yourFace < 1)
-
{
-
yourFace = 1;
-
cout << "You are facing North";
-
}
-
}
-
-
void yourTankFace()
-
{
-
int yourFace;
-
-
if( yourFace == 1)//North
-
{
-
cout << GREEN << (char)193;
-
}
-
else if(yourFace == 2)//South
-
{
-
cout << GREEN << (char)194;
-
}
-
else if(yourFace == 3)//West
-
{
-
cout << GREEN << (char)180;
-
}
-
else if(yourFace == 4)//East
-
{
-
cout << GREEN << (char)195;
-
}
-
}
-
-
void compTankFace()
-
{
-
int face;
-
-
if( face = 1)//North
-
{
-
cout << RED << (char)193;
-
}
-
else if(face == 2)//South
-
{
-
cout << RED << (char)194;
-
}
-
else if(face == 3)//East
-
{
-
cout << RED << (char)180;
-
}
-
else if(face == 4)//West
-
{
-
cout << RED << (char)195;
-
}
-
}
-
-
void move() // Move you forward
-
{
-
int x;
-
int y;
-
int action;
-
int moveX;
-
int moveY;
-
int yourTankX;
-
int yourTankY;
-
int face;
-
-
-
cout << "Choose an action: 1 - Move Forward, 2 - Rotate Left, 3 - Rotate right, 4 - Fire Laser, 5 - Lob Grenade." << endl;
-
cin >> action;
-
-
switch(action)
-
{
-
case 1: // move forward adding 1 to X or Y axis based on direction facing
-
while( x != 0 && x != 21 && y != 0 && y != 21)
-
{
-
if( 2== face || 4 == face)
-
{
-
moveX =yourTankX + 2;
-
}
-
else if ( 1 == face || 3 == face)
-
{
-
moveY = yourTankY + 2;
-
}
-
}
-
break;
-
-
case 2: // rotates you to the left subtracting 1 from face
-
// yourTankRotate();
-
break;
-
-
case 3: // rotates you to the right adding 1 to face
-
//yourTankRotate();
-
break;
-
-
case 4: // fires THE LAZER!
-
//shootL();
-
break;
-
-
case 5: // Lobs the grenade
-
//shootG();
-
break;
-
-
}
-
}
-
-
void hitLaser() // determines if the laser hit
-
{
-
int weaponY;
-
int yourTankY;
-
int compTankY;
-
int weaponX;
-
int yourTankX;
-
int compTankX;
-
-
if (weaponY == yourTankY || weaponY == compTankY)
-
{
-
-
shieldLeft();
-
}
-
else if (weaponX == yourTankX || weaponX == compTankX)
-
{
-
-
shieldLeft();
-
}
-
-
}
-
-
void hitGrenade() // determines if the Grenade hits
-
{
-
int weaponY;
-
int yourTankY;
-
int compTankY;
-
int weaponX;
-
int yourTankX;
-
int compTankX;
-
-
if (weaponY + 3 == compTankY)
-
{
-
-
shieldLeft();
-
}
-
else if (weaponX + 3 == compTankX)
-
{
-
-
shieldLeft();
-
}
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Michael Rybak |
last post by:
hi, everyone.
I'm writing a 2-players game that should support network mode. I'm now
testing it on 1 PC since I don't have 2. I directly use sockets, and
both client and server do...
|
by: jim figurski |
last post by:
Hi,
I have an American computer using windows XP. I recently bought a
japanese game to help me learn japanese as I play. I installed the
game sucessfully, but the letters are not displayed in...
|
by: Ivan Weiss |
last post by:
Hey all, I want to try to create a replacement Winamp (hopefully many
are familiar with this) with only the features I need stripped down
because I like the original software, but lately it has...
|
by: Darren Soo via .NET 247 |
last post by:
Hi, wondering if anyone can help me out here. I wrote a VB.NETapplication with Windows Media Player embedded into theapplication. The player is suppose to start automatically whenthe application...
|
by: benmourra |
last post by:
Hi all,
I'm trying to create a web page using VS2005, ASP.NET 2.0, that will
allow me to choose from a list of media files on my computer and then
play my selection within an embedded Windows...
|
by: tanv70 |
last post by:
Hello,
I am considering starting up my own online gaming site to include muti-player bingo, slots, keno, and possibly more.
This will need to include player registration and password...
|
by: Jeff Rush |
last post by:
At PyCon this year we're going to have a multi-day game programming clinic and
challenge. This is a first-time event and an experiment to find those in the
Python community who enjoy playing and...
|
by: artsohc |
last post by:
Hey Everyone, this is my first time posting so go easy on me. I am trying to hook up music-on-hold at the office I work at. I got all the music loaded and I got Windows Media Player working while...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |