NewToC++
10-28-2008, 03:00 PM
hi guys, i'm very new to c++ and don't know much about what i'm doing. hopefully somebody can help?
i have an assignment to create a game in c++ where a guy is trapped in a maze. if he finds the exit, the game ends and you win. however, there is a monster lurking hidden throughout the maze. if you land on the monster's spot, you get eaten and lose.
it looks like this...
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * M * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
-the monster is hiding underneath one of the *'s.
-the monster, man's position (denoted by M), and exit are all randomly selected points.
- the man moves when the user selects U, D, L, R, UR (UP-Right), UL, DR, DL
- each time the man moves, a new set of *'s is re*****ed with the man's current position
also, if the man is at the bottom he needs to move to the top. for example:
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * M * * * * *
U, D, L, R, UR, UL, DR, DL: (user input) D
should look like this:
* * * * M * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
i'm having a lot of trouble just getting started. i can't even get the *'s to print to the screen correctly using a for loop. this is what i have:
for (i = 0; i < *00; i++)
{
cout << "* ";
if (i % *0 == 0)
cout << endl;
}
any help would be greatly appreciated!
i have an assignment to create a game in c++ where a guy is trapped in a maze. if he finds the exit, the game ends and you win. however, there is a monster lurking hidden throughout the maze. if you land on the monster's spot, you get eaten and lose.
it looks like this...
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * M * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
-the monster is hiding underneath one of the *'s.
-the monster, man's position (denoted by M), and exit are all randomly selected points.
- the man moves when the user selects U, D, L, R, UR (UP-Right), UL, DR, DL
- each time the man moves, a new set of *'s is re*****ed with the man's current position
also, if the man is at the bottom he needs to move to the top. for example:
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * M * * * * *
U, D, L, R, UR, UL, DR, DL: (user input) D
should look like this:
* * * * M * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
i'm having a lot of trouble just getting started. i can't even get the *'s to print to the screen correctly using a for loop. this is what i have:
for (i = 0; i < *00; i++)
{
cout << "* ";
if (i % *0 == 0)
cout << endl;
}
any help would be greatly appreciated!