A "Compass" for text RPG
Hello fellow coders!,
I want to create a simple text-text based RPG. The player will move on a 2d grid (x,y coords) with the options of n, s, e, w (north, south, etc.). What I want to do is design a Compass class that, depending on the x/y coords of the player, will output "NW", "E", or whatever the current direction happens to be. I thought about simply saying, for example:
// north-west movement
if ((yPosition > 0) && (xPosition > 0)
cout << "NW";
// northern movement
if (yPosition > 0)
cout << 'N';
etc., but it doesn't work; I get conflicting messages. Suggestions?
Ah, but there is ONE more thing I want to do, but am having problems with this as well. Within certain x/y coord. ranges, I want to "name" sections of land. For example if y is between 1-4 and x is between 1-4, the text "Village of Neutrality" would be shown on the screen. Then if they player moved and the coords. were, say, y between 5-100, x between 5-100 (NE movement), it might output "Forest of Evil Stuff" or something. In other words I'd like to "spruce up" the game because it is simple text (I'm just getting into game dev.) adventure, and I thought that the implementation of a compass along with a "map" informing the player as to their location might be something to make the game more interesting. The main purpose of the compass and map are to test my programming skills. Challenges help me advance, so I welcome them. :)
Any suggestions, codes, comments, ANYTHING? Please respond ASAP, and thx in advance for your help! ;)
Please do not cross post. Thanks.