First Game - would like help

Started by
2 comments, last by darookie 18 years, 4 months ago
Alright, this is the first game I've ever made, I pickd up a C++ book a month or so ago, and this morning I got accepted into Westwood College to get a Bachelors in Game Software Development. Anyways, I'm having some problems with this program. As of right now it doesn't do much. It asks for a password, then shows an info screen, then it gets into the game. first off, passwords = "EtherealDreams" case sensitive, one word I'll put big comments where I need the help feel free to run it as of now #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> #include <ctype.h> // for tolower() function #include <iostream> // for any C++ code //||-------------------------------|*| //||--- Function Prototypes -------|*| //||-------------------------------|*| //||--- Box Functions -------------|*| void NewLine(); void ShowBox(int level); //||-------------------------------|*| //||- Movement Detecting Functions-|*| int GetMovement(); //||-------------------------------|*| //||--- Welcome & Help Function ---|*| void GetIntro(); void GetHelp(); //||-------------------------------|*| void PasswordProtected(); // Password protection added w00t w00t void main() { PasswordProtected(); int level = 0; // not yet used int game = 1; GetIntro(); // shows the intro screen with the basic commands clrscr(); while(game == 1) { ShowBox(level); // calls the function to display the side of the box GetMovement(); getchar(); clrscr(); } getchar(); // so you can see the end result } /********************************************************************************************** *** I want the array aSideBox to be affected by which direction you wish to go in ************ *** for example if you want to go north: aSideBox[j] add 1 to 'i' to move the charater up ***********************************************************************************************/ int GetMovement() { char movement = 0; printf("Enter the direction you wish to move: "); movement = getch(); switch(movement) { case 'n' : case 's' : case 'e' : case 'w' : case 'q' : break; default: ; } return movement; } void GetIntro() { char useless; printf(" E\n"); printf(" T\t\tWelcome to Veritas\' \"Guido Forest\" v1.\n"); printf(" H\t\tThe commands are easy to use. They are \n"); printf(" E\t\tin [ ] and must be entered in lowercase.\n R\n"); printf(" E\t\tNorth = [n]\tEast = [e]\tQuit = [q]\n"); printf(" A\t\tSouth = \tWest = [w]\n"); printf(" L\n\n D \t\tSymbols in this game are as follows:\n"); printf(" R\n E\t\tYour Position = \'P\'\tCharacter = \'C\'"); printf("\n A\t\tNew Map = \'L\'\tBuilding = \'H\'\n"); printf(" M\n S\n\n"); printf(" I\n N\n C\t\tPress ENTER when you\'re ready to begin…"); scanf("%c", &useless); } void GetHelp() { char useless[1]; printf("The commands again are :\n"); printf(" "); printf(""); printf(""); printf("Press ENTER when ready…"); scanf("%c", &useless); } void ShowBox(int level) { NewLine(); /****************************************************************************** *** I'm giong to have several variations of aSidebox_# : aSidebox_1, _2, _3 *** to make the area of play bigger ******************************************* ********************************************************************************/ // initialize long fuckin' list of arrays for co-ordinates char aSidebox_1[20][40] = { { 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' }, // 0 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 1 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 2 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 3 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'H', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 4 row { 'X', ' ', ' ', ' ', 'H', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 5 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 6 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 7 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'H', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 8 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 9 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 10 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'H', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 11 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 12 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 13 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'H', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 14 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 15 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 16 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', 'H', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 17 row { 'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X' }, // 18 row { 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' } // 19 row }; int x = 0; int k = 0; while(x &lt; 20) { int i = 0; for(i=0;i &lt; 40; i++) { printf("%c", aSidebox_1[k]<span style="font-weight:bold;">); // **** THIS RIGHT HERE is the initial starting point of // **** the players position, I need this to change **** if((k == 3) && (i == 28)) // **** and I need 'P' to move aroudn the board ********** { printf("\b%c", 'P'); } } k++; x++; NewLine(); } } // Inserts a new line and an automatic tab void NewLine() { printf("\n\t"); } /********************************* ********* Password = ************* ******* EtherealDreams *********** ********************************** *********************************/ void PasswordProtected() { char encrypted[] = "IsANANaYUSLojWlgrwJE"; char password[80]; char unencrypted[21]; bool correct = 1; int i = 0; long code = 0; while(correct) { strcpy(unencrypted, "abcdefghijklmnopqrst"); printf("\nEnter your password:\n"); scanf("%s", password); clrscr(); for(i = 0; i &lt; 20 && password<span style="font-weight:bold;"> != '\0'; i++) { unencrypted<span style="font-weight:bold;"> = password<span style="font-weight:bold;">; } code = 0; for(i = 0; i &lt; 20; code += unencrypted[i++]); code %= 52; code += code &lt; 26 ? 'A' : ('a' - 26); for (i = 0; i &lt; 20; i++) { code *= unencrypted<span style="font-weight:bold;">; code %= 52; code += (code &lt; 26) ? 'A' : ('a' - 26); password<span style="font-weight:bold;"> = (char)code; } password<span style="font-weight:bold;"> = '\0'; if(!strcmp(password, encrypted)) { printf("\n\t\t\tPassword OK.\n"); correct = 0; } else printf("\n\aIncorrect password.\n"); } getchar(); }
____________________________It is your corrupt we claim.
Advertisement
I know I'm gonna get crap for my first sentence.

so change C++ to C and be forgiving..
____________________________It is your corrupt we claim.
Quote:Original post by veritas
I know I'm gonna get crap for my first sentence.

so change C++ to C and be forgiving..


You can always edit your post by pressing the edit button in the upper right corner.

As for your game I took only a brief look at your code. The only comment I will make is that you should try using a graphics API for your game. It should take you under a week to make a basic OpenGL/DirectX game. The key is to start from a premade framework. Learn how to draw and move some polygons and you are ready to go.

My project`s facebook page is “DreamLand Page”

Quote:Original post by Calin
Quote:Original post by veritas
I know I'm gonna get crap for my first sentence.

so change C++ to C and be forgiving..


You can always edit your post by pressing the edit button in the upper right corner.

As for your game I took only a brief look at your code. The only comment I will make is that you should try using a graphics API for your game. It should take you under a week to make a basic OpenGL/DirectX game. The key is to start from a premade framework. Learn how to draw and move some polygons and you are ready to go.

Alternatively you can use SDL, which might make things a little easier for you as you don't have to deal with 3D, window creation and the like.

This topic is closed to new replies.

Advertisement