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 1764
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
-
{
-
-
}
-
-
JosAH 11,448
Recognized Expert MVP
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 computations, the only data transfered is
user mouse/kbd input.
It works synchronously, but somehow, when I play in client window,
both client and server have 17 fps, while when playing in server
window, server has 44 fps while client ...
|
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 "true"
japanese. What I mean by that is, there are a few letters that
actually are japanese combined with nonsensical characters. It
resemebles the type of characters that are displayed if you select a
japanese font other than the standard one...
|
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 gone far from
what I enjoy using) and the old software is no longer available.
I want to create basically a simple media player than can play
everything from mp3's to cd's to movie files. For now, I just want to
start with audio and it is only...
|
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 loads. I tried it on my computer and everythingworks perfectly. However, when I did a setup wizard project andinstalled it on another computer, the app started, I can hearthe sound of the movie, but there are no visuals. Anyone knowthe reason why?
...
|
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 Media Player on the page.
I've been able to eventually find out how to embed the player into the
page by manually inserting code into the source view of my aspx file.
It plays the file specified in the source view, but I'd like to be able
to...
| |
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 retrieval, scripts for the games to run smoothly, database for wins/losses, a My account area so players can edit information, e-commerce so I can actually make money from the site eventually, more?
I know only basic web design and will need extensive...
|
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 creating games. Python has several
powerful modules for the creation of games among which are PyGame and PyOpenGL.
On Friday evening, Phil Hassey will give an introduction to his game Galcon,
an awesome high-paced multi-player galactic...
|
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 the phones are on hold, but now I am trying to write a script that will allow Windows Media Player to run as a service so I can make it auto-start with out needing a user logged in on the computer. Also it would allow the music-on-hold to work if we...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |