I need help trying to make a map that the character can move in out of text. I literally been sitting here the last hour trying to think how I could do this, but don't know how I would even start it. The only thing i know is that it uses arrays. Could anyone explain how I make one, or link me to something that explains it? I've searched myself, but haven't found anything really explaining how.
What is the context here? Are you talking about a text-based dame or some sort of graphical display? Have you any existing code or is this still at the ideas stage?
You could use curse , winapi , or linux/mac stuff maybe? ex:
Move the cursor around and insert new item removing the old item.
1 2 3 4 5 6
void gotoXY( constunsignedint x , constunsignedint y )
{
HANDLE outHandle = GetStdHandle( STD_OUTPUT_HANDLE );
COORD position = { x , y };
SetConsoleCursorPosition( outHandle , position );
}
Then maybe use conio/curse or some sort of method to get the input to move the "character" to the new position removing it from the old position and placing a space or w/e.
As Chervil suggested, how you display the game board does depend on whether or not it's graphical or text-based. And as Giblit pointed out, there are various libraries available for graphical interfaces.
I suggest building in the background a virtual map, using a container or array as you mentioned (I prefer an array because it is easier for me to visualize what goes on). It is up to you.
Then, you can create some kind of interface class that decides how to display the actual sprites, whether it be all text or graphical. If you separate how the map is altered in the background and how it is displayed, it'll be easier for you to switch out SFML, curses, WINGUI, text-based, etc.
If you are having trouble planning out what to do, start out with a simple class with an array/container as a member variable. Build a couple methods for manipulating the map image, try visualizing how you want things to happen, and see if that gets the juices going in the brain.