If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

C++ Text based game..

Hello everyone, am new. I wondered if could help me get my head around the coding side of things.
I have started to make a text based game for uni, its part of the course.
I know what I need in it, I know what to do.. but for the life of me I cant code the thing.

My first mission on this is to first display a random x and y coordinates of both you (the player and 10 enemies on a 10x10 grid)
Bare in mind that i dont have to make the grid, just put if statements on the coordinates to limit the number from going any higher than 10.

Re: C++ Text based game..

C++ does not have a default means to directly access screen coordinates or to display text at a specific location.

The Windows API does have functions to more directly control a console window, which among others includes querying the window size, the buffer size, changing both, accessing/reading/writing characters at a specific x,y coordinate, changing color and color background. But of course, this will make your game windows specific (it won't be recompilable and runnable for a linux machine).

An alternative approach is to 'redraw' the entire playing field on every change, but that has some visual issues of it's own.

depending on what you really want to do, it may be simpler even to write your own simple GUI based application.