Thread: New Game

  1. #1
    Confused
    Join Date
    Nov 2002
    Location
    Warwick, UK
    Posts
    209

    New Game

    Hello,

    I'm brand new to C++, or to any type of programming, so I don't know much at all... I have a few questions :

    1. in a "cout", how can I write "\" without the compiler telling me I need something else behind it ( it wants me to put "\n" ( new line ) or things like that...

    2. I am making a game using C++, but the way I set it out means it'll take me months to finish, and the program will be huge. Here is my code :

    Code:
    #include <iostream.h>
    #include <string.h>
    #include <conio.c>
    #include <windows.h>
    #include <stdio.h>
    
    char word[100];
    char name[50];
    char spe[50];
    int str[500];
    int def[500];
    char xit;
    char wea[50];
    int act11[1];
    int act12;
    int act13;
    int act14;
    int act15;
    int act16;
    int act17;
    int act18;
    int act19;
    int act20;
    int act21;
    char acro_name[50];
    
    void type(char* word)
    {
    
    	for (int i = 0; word[i] != '\0'; i++){
    		cout << word[i];                      //output a letter
    		Sleep(25);                            //wait for a small moment
    	}  //outputs text slowly
    	
    	Sleep(50);                         
    		   
    } //end void slowtype
    
    
    
    
    int main()
    
    { 
    clrscr();
    gotoxy(28,10);
    type("Den of Wolves Alpha Edition");
    Sleep(1000);
    clrscr();
    gotoxy(28,10);
    type("Producer : Korh3dron");
    Sleep(500);
    gotoxy(24,12);
    type("Programming Aid : [ra$h 0ver1de");
    Sleep(1000);
    clrscr();
    
    cout << "Enter a name for your character." << endl;
    cin >> name;
    cout << endl << "Class ?";
    cout << endl << "[EG. Fighter / Thief / Mage etc.]" << endl;
    cin >> spe;
    cout << endl << "Character Statistics ? [Must add up to 100 or less, in two categories]" << endl;
    cout << "Strength ?" << endl;
    cin >> str[500];
    cout << endl << "Defense ?" << endl;
    cin >> def[500];
    
    if (str[500] + def[500] > 100)
    
    { 
    cout << "Your stats are higher than 100. Press any key and ENTER to try again." << endl;
    cin >> xit;
    return main();
    
    }
    
        else
    
        {
    
        cout << endl << "Choose a weapon for your character." << endl;
        cout << "[EG. Sword / Spear / Bow / Wand etc.]" << endl << endl;
        cin >> wea;    
        
        }
        
        clrscr();
        
        type("Creating Character");
        Sleep(200);
        cout << "."; 
        Sleep(200);
        cout << "."; 
        Sleep(200);
        cout << "."; 
        Sleep(400);
        cout << " DONE." << endl;
        
        type("Configuring Statistics");
        Sleep(200);
        cout << "."; 
        Sleep(200);
        cout << "."; 
        Sleep(200);
        cout << "."; 
        Sleep(400);
        cout << " DONE." << endl;
        
            type("Activating Console");
        Sleep(400);
        cout << "."; 
        Sleep(400);
        cout << "."; 
        Sleep(400);
        cout << "."; 
        Sleep(700);
        cout << " DONE." << endl;
        
        
        
        Sleep(500);
    cout << endl << "Thank you, " << name <<", your character is ready." << endl;
    cout << "Here is your character :" << endl;
    cout << endl << "Name : " << name << endl;
    cout << "Status : " << spe << endl;
    cout << "Stats : " << str[500] << " / " << def[500] << endl;
    cout << "Armed with : " << wea << endl;
    Sleep(3500);
    
    clrscr();
    
    
    cout << endl;
    type("Loading Level One");
    Sleep(200);
    cout << ".";
    Sleep(200);
    cout << ".";
    Sleep(200);
    cout << ".";
    Sleep(400);
    cout << " DONE." << endl;
    
        type("Inserting Human Interface Key");
        Sleep(200);
        cout << "."; 
        Sleep(200);
        cout << "."; 
        Sleep(200);
        cout << "."; 
        Sleep(400);
        cout << " DONE." << endl;
    
    
    Sleep(2000);
    
    
                    //LEVEL 1::
                    //
                    //
                    
    
    clrscr();
    
    gotoxy(30,2);
    type("LEVEL ONE\n\n");
    
    
    type("You exit the forest, where you had been travelling for weeks.");
    cout << endl;
    type("The sight of a village fills your heart with joy.");
    cout << endl;
    type("You notice a small shop, and also an inn. Do you :");
    cout << endl;
    cout << endl;
    type("1. Go get a bite to eat");
    cout << endl;
    type("2. Look at the items on sale in the shop.");
    cout << endl;
    cout << endl << "[" << name << "] : ";
    cin >> act11[1];
    
    if (act11[1]==2)
    { 
    clrscr();
    type("\nThe shopkeeper has nothing much of interest apart from a blood red ring");
    type("\naround her neck. She seems reluctant to sell it, but you know you'll");
    type("\nbe back for it before long, as it seems to draw you to it.");
    type("\nYou head on to the bar now, but on your way out of the shop, you find");
    type("\na dusty journal hidden in some hay. You hide it under your cloak.");
    type("\nOn your way to the bar, a man beckons you to his table.");
    type("\nThe man is friendly and kind. He decides to buy you a drink. Do you accept ?");
    type("\n\n1. Yes, of course.");
    type("\n2. No, you are cautious.");
    cout << endl;
    cout << endl << "[" << name << "] : ";
    cin >> act12;
    
    }
    else {
    }
    
    
    if (act11[1]==1)
    {
    clrscr();
    type("\nOn your way to the bar, a man beckons you to his table.");
    type("\nThe man is friendly and kind. He decides to buy you a drink. Do you accept ?");
    type("\n\n1. Yes, of course.");
    type("\n2. No, you are cautious.");
    cout << endl;
    cout << endl << "[" << name << "] : ";
    cin >> act12;
    }
    
    else {
    }
    
    if (act12==1)
    {
    clrscr();
    type("\n\nYou start to ask the man his business in this village when you black out.");
    type("\nYou wake up only to find yourself stripped of all your money and weapons,");
    type("\nand tied to a stake. People stare at you wickedly, and avoid your glance.");
    type("\nA noble brings his horse close to you and whispers in your ear, ''Sorry.");
    type("\nbut someone must be convicted. You are innocent, we know, but we must set");
    type("\nthe example to witches here.''");
    type("\nHorrified, you see a hooded man set fire to the stake. You burn like a");
    type("\ntorch in oil. Wrong move, sorry. You lose.");
    cin >> xit;
    return 0;
    }
    else {
    }
    if (act12==2) 
    {
    clrscr();
    type("\n\nUpon refusing, the man eyes you, and shouts something in a foreign language.");
    type("\nYou see three heavily built men stand from corners of the room. They rush");
    type("\ntowards you, but you manage to avoid them by ducking. Drawing a small dagger,");
    type("\nyou decapitate one, stab one in the back, and slice off the third's arm.");
    type("\nYou grab the man at the bar and pull him outside into an empty street,");
    type("\nwhere you interrogate him. He tells you about an organisation whose aim");
    type("\nis to burn witches, and that he had been chosen to be set as an example");
    type("\nto witches in this village. You know where to go : their headquarters is");
    type("\nin an old ruined building down the hill. Do you :");
    type("\n\n1. Kill this man and take his eerie looking amulet");
    type("\n2. Let him run, and avoid the headquarters for the time being");
    cout << endl;
    cout << endl << "[" << name << "] : ";
    cin >> act13;
    }
    else {
    }
    
    if (act13==1)
    {
    clrscr();
    type("\n\nThe arrogant's head comes off quickly, and you grab his amulet in midflight.");
    type("\nThis piece of jewelery seems to attract shadow towards it, and you feel a");
    type("\nsurge of power as you hold it tight. You now head for the witch-hunters'");
    type("\nmain refuge.");
    }
    else {
    }
    if (act13==2)
    {
    clrscr();
    type("\n\nThe man desperately runs for his life, screaming something in his strange");
    type("\nlanguage which reminds you of an ancient dialect from a far away kingdom.");
    }
    else {
    }
    
    type("\nOn your way to the witch-hunters' lair, a man jumps down in front of your");
    type("\nhorse. The horse panics, but you manage to control it. You jump down and");
    type("\ndraw your weapon.");
    type("\n\n[Man] : My lord, my lord, do not pull on me your faithful Excalibur.");
    type("\nI have heard that you are a travelling ");
    cout << spe;
    type(" and that you were on your way\nto a dangerous place.");
    type("\nPerhaps you seek my help. Allow me to present myself. I am Yothlinkaqueetlz,");
    type("\nbut you may, if you choose to accept my assistance, dub me with a shorter");
    type("\nname. I am an acrobat whose skill involves thievery, and am a strong arm");
    type("\nwith a dagger. I may help you learn the arts of combat and assassination");
    type("\nif you wish, and we will train hard to become proficient in all masteries");
    type("\nof combat. I ask only that we venture as my heart is thirsty for adventure.");
    type("\nI also, of course, ask for your trust.");
    type("\n\nDo you choose to accept the acrobat into your party ?");
    type("\n\n1. Yes, join me.");
    type("\n2. No, I work alone.");
    cout << endl;
    cout << endl << "[" << name << "] : ";
    cin >> act14;
    
    if (act14==1)
    {
    clrscr();
    type("\n\n[Yothlinkaqueetlz] : Sire, I shall accompany you where good you feel,");
    type("\nand help in whatever way I can. Would you desire to name me shorter ?");
    type("\n\n1. Yes, I indeed would.");
    type("\n2. No, Yothlinkaqueetlz is fine.");
    cout << endl;
    cout << endl << "[" << name << "] : ";
    cin >> act15;
    }
    else {
    }
    if (act14==2)
    {
    clrscr();
    type("\n\n[Yothlinkaqueetlz] : Very well, sire. You have turned down my aid,");
    type("\nand I refuse to push you further. I cannot say we shall meet again, yet who");
    type("\nknows ? You watch this potential friend walk away, and you are overcome");
    type("\nwby regret. This man was the first friendly soul to address you since");
    type("\nyour journey began. However, you feel that he was not only interested");
    type("\nin helping, but more so in a certain wage.");
    }
    else {
    }
    
    
    if (act15==1)
    {
    clrscr();
    cout << endl << endl << "A friend joins you in your quest. Rename ?";
    cout << endl << "Default name : Yothlinkaqueetlz";
    cout << endl << "New name : ";
    cin >> acro_name;
    clrscr();
    type("[");
    cout << acro_name;
    type("] : Very well, then, I am ");
    cout << acro_name;
    type(". What is your \njourney and quest ?\n");
    type("\n\n1. I am not purely a wondering man, \nas I seek my family, disappeared");
    type("from one day to the next, \nwith no traces, apart from this dust...");
    type("\n2. I travel from kingdom to kingdom, seeking vast riches.\n");
    cout << endl << "[" << name << "] : ";
    cin >> act15;
    }
    else {
    }
    
    if (act14==1)
    {
    cout << "[" << acro_name << "] :"; 
    type("Sire, I say we head for the clearing in the forest. There are");
    type("always many creatures to fight off, and 'tis a great place for use of weapon.");
    type("\n\n1. Yes, let's go there...");
    type("\n2. No, thank you, let me fight with you first.");
    cout << endl << endl << "[" << name << "] :";
    cin >> act16;
    }
    
    else {
    }
    if (act14==2)
    {
    type("\nWalking in the streets of this small village, you suddenly feel watched.");
    type("\nSuddenly, five armed men spring at you, and circle you strategically.");
    type("\nThey ask you for your money or your life.");
    type("\n\n1. Here, have my money, but let me go !");
    type("\n2. I'll never give into this blackmail ! Draw steel !");
    cout << endl << "[" << name << "] :";
    cin >> act17;
    }
    else {
    }
    
    if (act17==1)
    {
    type("\n\nThe smallest man grabs hold of the bag of gold you have just thrown him.");
    type("\nNow each man eyes you, laughs, and look at the small man with your gold.");
    type("\n[Dolak] : What's this ? Only 31 gc ? I thought you were a noble...");
    type("\nYou just made us waste our time. What do you say we spike him, boys ?");
    type("\nThe men give faint nods, and jump at you. You don't even have time to");
    type("\ndefend yourself, and before you know it, you are held tight to the wall");
    type("\nbehind you with daggers, and the small man is waving his arms about frantically.");
    type("\nYou understand he is casting a spell.");
    
    if (spe=="Mage")
    {
    type("\nWith your knowledge of magic, you are able to counter his spell before it hits.");
    type("\nThe wizard becomes furious. He draws a small dart, and plants it into your");
    type("\nshoulderblade. You feel agony as a strong poison spreads through your body.");
    type("\nLooks like the end of the line. Game Over.");
    cin >> xit;
    return 0;
    }
    else {
    type("\nYou see a bolted of arched blue lightning fly at you, and your life extinguishes");
    type("\nlike a candle smothered by two fat fingers. Wrong move, your quest ends here.");
    cin >> xit;
    return 0;
    }
    }
    
    return 0;
    
    }




    Can anyone tell me what to do to make it better ?



    &#91;code]&#91;/code]tagged by Salem

  2. #2
    Confused
    Join Date
    Nov 2002
    Location
    Warwick, UK
    Posts
    209
    I thought you might also like the source file in cpp format...

  3. #3
    very interesting game you got there quints.... how about trying
    Code:
    cout<<"I am male'\'15'\'moscow";

  4. #4
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    \\ turns into one \ in quotes
    hello, internet!

  5. #5
    erggg ohh yeah i knew that!!

  6. #6
    Confused
    Join Date
    Nov 2002
    Location
    Warwick, UK
    Posts
    209
    Thanks a lot man !
    Last edited by Korhedron; 11-30-2002 at 01:07 PM.

  7. #7
    shut your lips!! don't expect me to help u ever again

  8. #8
    Confused
    Join Date
    Nov 2002
    Location
    Warwick, UK
    Posts
    209
    Alright... sorry if you felt offended... I modified my last post.

  9. #9
    don't worry i wasn't offended its just you started learning c++ too and now we are going to be competitive i hate this!!

  10. #10
    Confused
    Join Date
    Nov 2002
    Location
    Warwick, UK
    Posts
    209
    Man, you're like my guru... or at least you would be if you were a bit more sympathetic when I had C++ questions ( always, I know )... I have no competitive ideas and am not interested in taking you over... Remember the game you're working on, I said we'd team up to make it online game things ? I'm not learning C++ to annoy you, I'm doing it for me...

  11. #11
    by the way i opened my own board come there we will talk as much about C++ as you want

    http://users.boardnation.com/~devour89

  12. #12
    Confused
    Join Date
    Nov 2002
    Location
    Warwick, UK
    Posts
    209
    We have a programming topic in our boards ! Man, can you get on MSN ? I can't talk like this !

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-08-2010, 12:08 AM
  2. Open Source / Semi Open source game idea. Help needed
    By CaptainPatent in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 05-16-2007, 10:44 AM
  3. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 03:46 PM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM