Thread: Text-Based Space Simulator

  1. #16
    Registered User
    Join Date
    May 2005
    Posts
    41
    I also think Macintosh 84 is Windows 95, which is just a GUI for DOS (Isn't it?)

    But I thank everyone for their help, although I just thought I would ask, is your REDRAW_ENGING capable fo doing 3d?


    Any way, does anyone know if its possible to print all instances of a class, as I need to be able to list all planets, as well as showing the coordinates of each planet.

    Also, how I could detect if the player has arrived at a planet, I was thinking of something like:

    Code:
    int main(){
              pName.checkl();
              }
        
        class planet
        {
            int sLy;
            int sLx;
            int sLz;
            string sName
    
            public:
              void checkl(){
                         if (sLx==pLx){cout<<"You have arrived at the
                                               planet "<<sName<<"!\n";}
        }class pName

    Thank you in advance, and for all of your other help.
    Last edited by Nebbuchadnezzar; 07-08-2005 at 07:21 PM.

  2. #17
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Look into linked lists. At least, that's how I would do it in C.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #18
    Registered User
    Join Date
    May 2005
    Posts
    41
    Well I've gone with your suggestion, and will be creating a linked list for my planet class.

    I've got 1 question though, how could I detect if the player has arrived at a certain planet? I was thinking of using an array, however wouldnt this mean that the program would have to create a new variable every time a new planet was created?

    Thank you for your help, and any more you offer me.

  4. #19
    ---
    Join Date
    May 2004
    Posts
    1,379
    Again, use a linked list. Dynamically create and destroy your planets as you need them as well as being able to find out how many planets exist and whatever else you can think of.

  5. #20
    C maniac
    Join Date
    Aug 2004
    Location
    Cyberwarping to Middle Earth
    Posts
    154
    Check if the player XP==Planet XP and Player YP==Planet YP

    XP=X Position
    YP=Y position

    And the redraw_engine is not capable of doing 3D. How long have you been programming?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 01-29-2008, 04:40 AM
  2. text based game
    By PippinofTook in forum Game Programming
    Replies: 5
    Last Post: 08-24-2005, 06:56 PM
  3. easiest way to make text based game?
    By oceanrats in forum C++ Programming
    Replies: 7
    Last Post: 08-13-2005, 02:17 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Text Based Game
    By drdroid in forum C++ Programming
    Replies: 2
    Last Post: 02-18-2002, 06:21 PM