Jump to content

  • Log In with Google      Sign In   
  • Create Account


armitroner

Member Since 06 Jun 2012
Offline Last Active Nov 20 2012 08:40 AM

Topics I've Started

C++ - Is Goto a Good Practice?

11 November 2012 - 06:31 PM

I've made a simple little text-based game that implements an extremely primitive menu. For it, I have designed a small option menu for attacks. Before, it used to automatically move on to the opponent's attack if you happened to use the gun attack if you were out of ammo, so I fixed that by adding a goto function that reverts back to the option menu before the enemy initiates it's attack.

I've read in some places that goto is unreliable, and indeed, shouldn't be used in most cases. I was just curious as to specifically why this is, and what alternative could I use?

Need C++ Roguelike Tutorial

07 June 2012 - 09:05 AM

Despite my hunting the internets, my bounty hunter visor fails to locate any C++ tutorials for simple roguelikes.

Can anyone point me to a good roguelike tutorial for C++?

Thanks! ^_^

Load of errors concerning 'console' function.

06 June 2012 - 11:12 AM

I was starting on programming my first game ever, a roguelike. I typed out the bare essentials, and I even have the help of a small tutorial, but when I tried to compile this, it gave errors such as:

Symbol 'console' could not be resolved.
Symbol 'true' could not be resolved.
Method 'Clear' could not be resolved.
Method 'Position' could not be resolved.
Program 'make' is not found in PATH.

I'm using the latest Eclipse for Mac OS X.

Here's the program's code:

#include <conio.h>
#include "Console.h"

int main( void )
{
	 console.Clear();

	 int nPlayerX=40, nPlayerY=12;

	 while( true )
	 {

			//Output phase
			console.Position( nPlayerX, nPlayerY );
			console << '@';

			//Input phase
			char nKey = getch();

			//Processing phase
			switch( nKey )
			{

   			   //Move down
				 case 's':
   			   nPlayerY++;
   			   break;

   			   //Move left
				 case 'a':
				  nPlayerX--;
   			   break;

				  //Move right
				 case 'd':
				  nPlayerX++;
   			   break;

   			   //Move up
				 case "w":
				  nPlayerY--;
   			   break;

   			   //Quit
				 case 'q':
   			   return 0;
   			   break;

			}

}

	 return 0;

}

PARTNERS