Adventure game

This is a discussion on Adventure game within the C++ Programming forums, part of the General Programming Boards category; i just started to try C++ again as lately i have been using game maker programs. anyway, i would like ...

  1. #1
    Registered User MOH123's Avatar
    Join Date
    Aug 2005
    Posts
    20

    Adventure game

    i just started to try C++ again as lately i have been using game maker programs. anyway, i would like to make an adventure game(text based of course) using C++ but i really dont know how. could somebody give me a link or something to a tutorial showing how to do this?

    -thanks in advance.
    Games by Me:
    Using C++:
    Text Adventure game - No Name [||||||||||] - =0% -
    -----------------------------------------------
    Using RPG Maker 2000 and 2003:
    - No Games as of now -

  2. #2
    Registered User MOH123's Avatar
    Join Date
    Aug 2005
    Posts
    20
    oh and also, is there a way to change the color of text in C++?
    Games by Me:
    Using C++:
    Text Adventure game - No Name [||||||||||] - =0% -
    -----------------------------------------------
    Using RPG Maker 2000 and 2003:
    - No Games as of now -

  3. #3
    Linker.exe64
    Join Date
    Mar 2005
    Location
    Croatia,Pozega
    Posts
    37
    I have source to change color, but it works only on Windows.
    Maybe some headers will be missing...

    Code:
    /*******************************************************************
    	
    	[File name] : 
    		console.h
    
    	[date]		: 
    		2.7.2005
    
    	[Purpose]	: 
    
    *******************************************************************/
    
    
    #ifndef Console_h
    #define Console_h
    
    
    //-----------------------------------------------------------------
    //	eColors enumeration
    //		- Cerror is used as return value in catch statements
    //			when error occures.
    //		- null is added for balance.
    //-----------------------------------------------------------------
    enum eColors
    {
    	CERROR = -1, CNULL,
    	CDARKEST_BLUE, CDARK_GREEN, CDARK_BLUE, CDARK_RED, CDARK_PURPLE, 
    	CGOLD, CLIGHT_GRAY, CGRAY, CBLUE, CLIGHT_GREEN, CCYAN,
    	CRED, CPURPLE, CYELLOW, CWHITE
    };
    
    
    //-----------------------------------------------------------------
    //	class Console
    //-----------------------------------------------------------------
    class Console
    {
    
    public:
    	
    	Console();
    	~Console()
    	{
    		cout << "\n~\tConsole. color = " << _color;
    	}
    	
    	
    	eColors		getColor() const;
    	void		setColor(eColors);
    	void		clrscr() const;	//Clear the screen
    
    private:
    	
    	eColors _color;
    
    };
    
    
    //-----------------------------------------------------------------
    //	End
    //-----------------------------------------------------------------
    
    #endif	/*	(Console_h)	*/
    Code:
    /*******************************************************************
    	
    	[File name] : 
    		console.cpp
    
    	[date]		: 
    		2.7.2005
    
    	[Purpose]	: 
    		Implementation of the class 'console' from the console.h .
    
    *******************************************************************/
    
    
    
    
    //-----------------------------------------------------------------
    //	Includes
    //-----------------------------------------------------------------
    
    #include "Console.h"
    #include <iostream>
    	using std::cout;
    	using std::endl;
    #include <exception>
    	using std::cerr;
    #include <windows.h>
    
    
    //-----------------------------------------------------------------
    //	Global variables
    //-----------------------------------------------------------------
    HANDLE  hConsole = GetStdHandle(STD_OUTPUT_HANDLE);	//	For colors
    
    
    //-----------------------------------------------------------------
    //	Constructors & destructors
    //-----------------------------------------------------------------
    Console::Console():_color(CCYAN)
    {
    	try
    	{
    		Console::setColor(CDARK_GREEN);
    		cout << "\nConsole created with color " << getColor();
    	}
    	catch(exception &exc)
    	{
    		cerr << exc.what();
    	}
    }
    
    
    //-----------------------------------------------------------------
    //	Accessors
    //-----------------------------------------------------------------
    eColors Console::getColor() const
    {
    	try
    	{
    		cout << "\n\t\tgetColor() , " << eColors (Console::_color )<< "\n";
    		return Console::_color;
    	}
    	catch(exception &exc)
    	{
    		cerr << exc.what();
    	}
    	
    	return eColors(-1);		//	-1 is error value
    }
    
    //---------------------------------------
    
    void Console::setColor(eColors Color)
    {
    	try
    	{
    		if (Color > 15)
    			throw ("\nColor doesn't exist!");
    		Console::_color = Color;
    		SetConsoleTextAttribute(hConsole , Console::_color);
    	}
    	catch(exception &exc)
    	{
    		cerr << exc.what();
    		getchar();
    		exit(-1);
    	}
    	catch(const char *msg)
    	{
    		Console::setColor(CRED);
    		cerr << "\n\nError occured!\n\n*msg : " << msg;
    		cerr << "\nPress ENTER to exit....";
    		getchar();
    		exit(-2);
    	}
    }
    
    
    //-----------------------------------------------------------------
    //	Other functions
    //-----------------------------------------------------------------
    void Console::clrscr() const
    {
    	try
    	{
    		COORD coordScreen = { 0, 0 };
    		DWORD cCharsWritten;
    		CONSOLE_SCREEN_BUFFER_INFO csbi;
    		DWORD dwConSize;
    		HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    	    
    		GetConsoleScreenBufferInfo(hConsole, &csbi);
    		dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
    		FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
    		GetConsoleScreenBufferInfo(hConsole, &csbi);
    		FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
    		SetConsoleCursorPosition(hConsole, coordScreen);
    	}
    	catch(exception &exc)
    	{
    		cerr << exc.what();
    	}
    }
    
    
    //-----------------------------------------------------------------
    //	End
    //-----------------------------------------------------------------

    USAGE :
    Code:
    ...
    Console *Con = new Console();
    ...
    Con->clrscr();
    Con->setColor(CDARKBLUE);
    ...
    delete Con;
    Code:
     
     .J?+.                             ?`+.
       .+1P .++.                         ,+` 4++.
      .+zq\ .:.?i                      .!`?  .yz+.
      ?zdd ..:.^`J.                   ,!..?...Kyz+	
     .+dXM ..!p^.N.+                 ,,^.a..`.#XO+.
     .zwWM ^`.Mc`JMhJ.             .:JF`JM..^.#WOz`
      jwpMr`..NF.JMMM,!           .JMMF.dJ..`JNWrc
       0Wgb `!B:.MMMMM,:         ,.MMMF.j$.` NHSZ`
        TWMp`.+;`MMMMMM.:       ;.MMMMM.;+``JHW= 
          7Mh,``JMMMM"`          .TMMMMb``.H#"`
    

  4. #4
    Registered User MOH123's Avatar
    Join Date
    Aug 2005
    Posts
    20
    anybody know anything about a tutorial or something?
    Games by Me:
    Using C++:
    Text Adventure game - No Name [||||||||||] - =0% -
    -----------------------------------------------
    Using RPG Maker 2000 and 2003:
    - No Games as of now -

  5. #5
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    A tutorial on/about what?

  6. #6
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by Cool-August
    A tutorial on/about what?
    Making a text adventure game
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  7. #7
    Registered User
    Join Date
    Sep 2005
    Location
    USA
    Posts
    69
    Do you want to make a game with lots of C++ or use a prebuilt template? If you want to use something like a template go to www.TADS.org.
    Adam

  8. #8
    Android
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    363
    what's actually a "text adventure game"?
    if i wanna create a game, i would learn something like openGL, DirectX etc.
    also if u like, u can script good 2D games using Macromeadia Flash.
    Some useless programs i've wrote : slprogrammersheaven
    Youtube: http://www.youtube.com/user/geekyzine
    My amature IT Blog: http://everything-geeky.blogspot.com/
    My Flash games: http://flashweed.blogspot.com/

    (and, sorry for my amature english)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text adventure game - desgin
    By beene in forum Game Programming
    Replies: 9
    Last Post: 05-12-2008, 07:51 PM
  2. Text adventure game GUI
    By VirtualAce in forum Game Programming
    Replies: 11
    Last Post: 11-07-2007, 05:34 PM
  3. Try my game
    By LuckY in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-15-2004, 11:58 AM
  4. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  5. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21