Hello i was wonder how to make a map for my rpg that im going to code in c++
as in a map i want an environment that you can move a character like a "o"
but the map should look something like
**********************************************
* !!!!!!! !!!!!!!! *
* !! !! [------] *
* ^^^ [ ] *
* [------] *
* ^^ *
* ^ ^^^^ *
* ^ ^ o *
* ^^ ^^ ^^^ ~~~ *
* ~~ ~~~ *
* ~~ ~~ *
**********************************************
and the "o" can move around and if it enter something like the !! !! then it goes to a town.
C++ map
Re: C++ map
Is this a text based/console type application? I would probably use a two dimensional array, then a for loop to draw the characters. I would give you an example but I can't spend much time at the computer right now because I am getting stuff ready for me to go on vacation. I will see what I can do though.
Re: C++ map
Yeah it is a text based console application you cant really see the map because it got screwed up somehow but ok ill try to do that. thx =]
Re: C++ map
Here is what I have for the map drawing.
You can just change the 0s to whatever you want and resize the map how ever you want by adjusting the values. When it comes to movement that is a little more tricky. I haven't done that in awhile and I am going to have to think about how it is done and do some testing. I hope to be able to help you by tonight but I leave very early in the morning so I need to get to sleep early.
EDIT: Well I thought about it and looked around and all I can come up with is to draw the character at an x and y position in the grid and edit the value after input. Sorry I can't come up with an example but I have a few things to do before I go and I need to do them before I work on this anymore.
Code: Select all
#include <iostream>
#include <string>
using namespace std;
int main ()
{
char map[10][10] ={
{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},
{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},
{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},
{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},
{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},
{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},
{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},
{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},
{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'},
{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0'}
};
for(int y = 0; y < 10; y++)
{
for(int x = 0; x < 10; x++)
{
if(x == 9) cout << "\n";
else cout << map[y][x];
}
}
system("PAUSE");
return 0;
}
EDIT: Well I thought about it and looked around and all I can come up with is to draw the character at an x and y position in the grid and edit the value after input. Sorry I can't come up with an example but I have a few things to do before I go and I need to do them before I work on this anymore.
Re: C++ map
Thanks for the help cant wait for the moving thats what i really need so that i can make my text based rpg a little more fun and entertaining.