I am to make a program that is a game and is a pirate ship game. The ships are to start randomly in a 10x10 playing board (made with an array) and are to have four attributes [Movement (how many spaces a hip can move in one turn),Armor (how much damage it can take before being killed), Weapon (how strong the weapon is), and Range (how far can it shoot)].
What i need help on now is i think moving (before i get the attributes done), i would like to make it so the user enters where he wants to move (W for up, D for right, and A for left, NOT DOWN. Eventually this would be affected by the movement attribute so the user only has a certain amount of moves per turn.
But yeah, im at a loss guys and my teacher is very bad at helping me because he is way too vague and my classmates are all having trouble too. This project is a huge chunk of my grade so im pretty stressed out about it
Here's what i have so far:
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
const int ROW = 10;
const int COL = 10;
int player;
int computer;
void printBoard (int[][COL]);
int main(int argc, char *argv[])
{
int gameboard[ROW][COL];
srand(time(0));
player = rand()%99+1;
computer = rand()%99+1;
printBoard(gameboard);
system("PAUSE");
return EXIT_SUCCESS;
}
void printBoard (int [] [COL])
{
for (int rows = 0; rows < ROW; rows++)
{
for (int collumns = 0; collumns < COL; collumns++)
{
if ((player / 10) == rows && (player % 10) == collumns)
{
cout << " P";
}
if ((computer / 10) == rows && (computer % 10) == collumns)
{
cout << " C";
}
//else if statement here to check computer
else
{
cout << " *";
}
}
cout << endl;
}
}

New Topic/Question
Reply




MultiQuote




|