Thread: Text-Based

  1. #1
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269

    Question Text-Based

    I made this game (or at least tried to) a lot earlier. I had deleted it and moved onto other programs and learning more after that. Today I decided I wanted to pick it up again. So I opened my compiler, wrote the code, and got out the errors. Then I found out it will close at this one spot, and I can't figure out why.

    - SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Check your switch:
    Code:
    // How you wrote them:
    switch(choice)
    {
    case '1':
        dosomething();
        break;
    }
    
    // How you want them to be:
    switch(choice)
    {
    case 1:           // Notice that I dont have any ' ' around 1
        dosomething();
        break;
    }
    the ' ' are only nessecary (spelling?) around single char's, for example
    Code:
    switch(somechar)
    {
    case 'a':
        dosomething;
        break;
    }

  3. #3
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269
    Thankyou! That worked perfectly. Now I can focus more on creating more gameplay.

    - SirCrono6
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text based game..
    By MipZhaP in forum C++ Programming
    Replies: 8
    Last Post: 02-28-2005, 08:35 AM
  2. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  3. Looping Text based battle
    By pujuman in forum C++ Programming
    Replies: 7
    Last Post: 12-18-2004, 05:24 AM
  4. making a text based game
    By MisterSako in forum C++ Programming
    Replies: 1
    Last Post: 12-05-2004, 01:20 PM
  5. Text Based Game
    By drdroid in forum C++ Programming
    Replies: 2
    Last Post: 02-18-2002, 06:21 PM