Thread: A "Compass" for text RPG

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    17

    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!

    cpp4ever
    ------------------------------------------
    Normally I'd put something clever, but that isn't the point of being here now is it?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    375
    Please do not cross post. Thanks.
    Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. here it is again folks...news on my rpg
    By agerealm in forum Game Programming
    Replies: 3
    Last Post: 05-31-2010, 06:58 PM
  2. problem
    By ExDHaos in forum C++ Programming
    Replies: 12
    Last Post: 05-22-2009, 04:50 AM
  3. (dev) C++ Ascii Rpg
    By kevinawad in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 08-10-2008, 11:10 AM
  4. Char Variable Probelm
    By Krak in forum C++ Programming
    Replies: 1
    Last Post: 01-26-2003, 12:34 PM
  5. A "Compass" for text RPG
    By cpp4ever in forum Game Programming
    Replies: 5
    Last Post: 11-29-2001, 10:05 AM