2 Questions - PLEASE HELP!

Ok so like I said before I was making a small game

First off the 2 questions

1. How do I make it so the text comes after you click enter (So it shows one line of text and then you click enter and then the next line of text appears)

2. In my code I want there to be locations like in this game code: http://www.penguinprogrammer.co.uk/c-rpg-tutorial/moving-around
I have done what they said in the tutorial but ITS NOT WORKING!!! Please help!

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <iostream>
#include <string>


using namespace std;

bool running = 1;

int userInput = 0;

int playerInfo[2];

void titleFunc();

int playerLocation = 0;

int main()
{
    void titleFunc(); {
    cout << "\t\t\t\t---Xeon---\n\n\n";
    cout << "\t\t\t\t   1: Play\n";

    cin >> userInput;
    if(userInput == 1) {
            void newGameFunc(); {
            cout << "Welcome to Xeon!\nAn unexlored world full of adventurous paths and dangerous creatures!\n\n\n";
            cout << "I am Zolo... The DragonBorn!\n\n\n";
            cout << "Since you are a new comer to Xeon...\nCould you please tell me a little about yourself?\n\n";
            cout << "Are you a boy or a girl?\n 1: Boy\n 2: Girl\n";
            cin >> userInput;
            playerInfo[0] = userInput;

            cout << "And what kind of person are you?\n 1: Warrior\n 2: Archer\n 3: Thief\n 4: Scout\n 5: Mist\n";

    cin >> userInput;

    playerInfo[1] = userInput;

    cout << "You suddenly feel a gentle breeze pushing you but you ignore it\n\n\n";

    cout << "I thought I senced that in you! So now... Wait... Where are you going... What is happening!!\n\n\n";


    cout << "You suddenly feel the breeze turning into a violent wind.\nYou look down at your hands but they start disapearing...\nEverything around you is becoming blury...\nYou suddenly feel very dizzy and your vision starts to fade...\nAnd then... Everything turns Black!\n\n\n";

    playerLocation = 1;


            }

    }
    else {
        running = 0;
    }
     return 0;
}

    while (running) {
            if(playerLocation == 1) {

    cout << "You look around and you are in a wild jungle.\n You walk for a bit and you find yourself at the edge of a cliff.\n Eveything looks amazing and tropical around you!\n You look down and there is a sky blue lake.\n";
    cout << "Do you jump down or turn back?\n 1: Jump\n 2: Turn around and walk away\n";

    cin >> userInput;

    if(userInput == 1) playerLocation = 2;

    else if(userInput == 2) playerLocation = 3;

}

    }
    return 0;
}


HELP ME PLEASEEEEEEEEE!
Hi. I think you aren't getting replies because there are too many clueless errors in the code.

I looked at the site you linked to. I see that the code is given in fragments (individual parts which do a specific thing) so I conclude that you've pieced this code together yourself from the fragments supplied.
Try getting something simpler working right first. Don't try to code everything at once (especially when noob).

How familiar are you with the language itself?
It looks like you jumped in at "C++ RPG Tutorial".
I think you need to back up to the "C++ Beginners Tutorial" section.
This is no dig on you. The language is very technically precise and details matter.
Consider it as similar to learning the calculus. You wouldn't approach that subject casually, would you?

You'll have much better luck once you know how the language works better.
Last edited on
closed account (3qX21hU5)
I agree with fun2code, There are many problems in the code you posted that you should know how to fix if you know functions already. So like he said most likely you just copied and pasted it all together. So it would most likely be better to start off learning the basics first and then move on to the more challenging stuff.

Now this is not ment to be a insult to you or anything (actually the exact opposite), it just that C++ is one of the most complicated languages to learn and you need to take your time and make sure you understand everything before you move on to the next thing. Everything you learn at the beginning you will be using in everything you program from then on.

So try going back and starting at the beginners guide, or even check out our tutorial here (Pretty good tutorial). Just remember to take it slow make sure you understand what everything does. Here are some tips also

1. ALWAYS type in the code yourself. Never copy and paste code. If you type it in yourself you will start to learn what everything does and pay more attention to what you are coding.

2. Go a pace you feel comfortable with. Everyone learns at their own pace, Everything that you learn in the begining might be boring but you will be using it in every project you do from then on. So make sure you understand everything about it like functions, variables , loops, statements, ect.

3. Work from multiple sources. It doesn't matter if your reading from a book or a online tutorial. Its a proven fact that people understand things better if they look at it from different point of views. So try and have at least 2 different tutorials or books to work from, so if you don't understand someone on one of them you can look at the other one and see if their way of phrasing it clicks better.

4. Learn your IDE, and your debugger. When your first starting out it is always a good idea to get familiar with your IDE and see what it does and you know just tinker around with it. Also another important step is to see how the debugger and compiler work. One example is to type in some code you know compiles and runs. Then start changing things to make errors and see what error messages pop up. This way you will know later what that error message means cause lets face it some of them messages make almost no sense.

5. This is the most important of all. CODE, code everything you can think of. Try out new things even if they don't work. The more you actually code the more you will learn.
Topic archived. No new replies allowed.