Problem whilst making a game

So i ran into a bit of a problem while making my text-based game.
There are two places in this game - one is the House and the other is Outside. At the start of the game, you'll be put in the house and you can do certain activities there, but there is also a choice to go outside. Now the problem is that when you do go outside however, you can't go back to the house. Help would be very much appreciated!


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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <time.h>

bool startHouse, startOutside;
using namespace std;
int health, money, energy, knowledge, strength, charm;



void Setup()
{
    startOutside = false;
    startHouse = false;
    money = 200;
    health = 100;
    energy = 100;
    knowledge = 0;
    strength = 0;
    charm = 0;

}

void Story()
{
    retry:
    cout << "-----------Welcome to life simulator-----------" << endl;
    cout << "Shall we start?" << endl;
    cout << "1. Yes" << endl;
    cout << "2. YES!!" << endl;
    int input;
    cin >> input;
    switch (input){
    case 1:
        startHouse = true;
        break;
    case 2:
        startHouse = true;
        break;
    default:
        cout << "You're doing it wrong!" << endl;
        _getch();
        system("cls");
        goto retry;
    }
}


void House(){
    houseRetry:
    system("cls");
    cout << "You're at your house" << endl;
    _getch();
    cout << "What do you want to do?" << endl;
    cout << "1. Sleep" << endl;
    cout << "2. Go outside" << endl;
    cout << "3. Surf the web" << endl;
    cout << "4. Show stats" << endl;
    int houseChoice;
    cin >> houseChoice;
    //SLEEPING
    if(houseChoice == 1){

        if(energy >= 100){
            cout << "You're already fully rested" << endl;
            _getch();
            goto houseRetry;
        }
        else if(energy < 100){
            energy = (energy + 50);
                if(energy >= 100){
                    energy = 100;
                    cout << "You have now got " << energy << " Energy!" << endl;
                    _getch();
                    goto houseRetry;
                }
                else if(energy <= 100){
                    cout << "You have now got " << energy << " Energy!" << endl;
                    _getch();
                    goto houseRetry;
                }

            cout << "You have now got " << energy << " Energy!" << endl;
            _getch();
            goto houseRetry;
        }
    }
    //OUTSIDE
    else if(houseChoice == 2){
        cout << "You go outside" << endl;
        startOutside = true;
        startHouse = false;
    }
    //SURFING THE WEB
    else if(houseChoice == 3){
        cout << "You surf the web for a bit" << endl;
        //CAN RANDOMLY GAIN SOME KNOWLEDGE
        srand((unsigned)time(0));
        int rnum = (rand()%5) + 1;
        if(rnum == 1){
            cout << "You also learn some new stuff" << endl;
            cout << "KNOWLEDGE INCREASED BY 2" << endl;
            knowledge = knowledge + 2;
            _getch();
            goto houseRetry;
        }
        else{_getch();
        goto houseRetry;}
    }
    else if(houseChoice == 4){
        cout << "Money: " << money << ", Health: " << health << ", Energy: " << energy << endl;
        cout << "Knowledge: " << knowledge << ", Strength: " << strength << ", Charm: " << charm << endl;
        _getch();
        goto houseRetry;
    }
    else{
        cout << "You're doing it wrong!" << endl;
        _getch();
        goto houseRetry;
    }
}
void Outside()
{
    cout << "You're outside. What do you want to do?" << endl;
    cout << "1. Go back home" << endl;
    cout << "2. Go to the park" << endl;
    cout << "3. Go to the city" << endl;
    int outsideChoice;
    cin >> outsideChoice;
        if(outsideChoice == 1){
            cout << "You go back home" << endl;
            _getch();
            startHouse = true;
            startOutside = false;
        }
    //REST OF THE CHOICES ARE UNFINISHED
}
void Entry()
{
    mainRetry:
    cout << "PRESS ANY KEY IF THE GAME DOESN'T WANT TO PROGRESS" << endl;
    cout << "Enter how much knowledge, strength and charm you'd like to have" << endl;
    cout << "Pick a number from 1 to 10" << endl;
    cout << "Knowledge: ";
    cin >> knowledge;
    cout << "Strength: ";
    cin >> strength;
    cout << "Charm: ";
    cin >> charm;
    if(knowledge > 10){
        cout << "The values have to be less than 10" << endl;
        _getch();
        system("cls");
        goto mainRetry;
    }
    else if(strength > 10){
        cout << "The values have to be less than 10" << endl;
        _getch();
        system("cls");
        goto mainRetry;
    }
    else if(charm > 10){
        cout << "The values have to be less than 10" << endl;
        _getch();
        system("cls");
        goto mainRetry;
    }
    else{
    cout << "Okay, got it, press any key to continue" << endl;
    _getch();
    system("cls");
    }
}
int main()
{
    
    Setup();
    Entry();
    Story();
    if(startHouse = true){
        House();

    }
    if(startOutside = true){
        Outside();
    }
    return 0;
}
Well, your lines 181-187 won't help you:
1
2
3
4
5
6
7
    if(startHouse = true){
        House();

    }
    if(startOutside = true){
        Outside();
    }


Those = should be ==
Thus:
1
2
3
4
5
6
7
    if(startHouse == true){
        House();

    }
    if(startOutside == true){
        Outside();
    }


Single = means assignment (which isn't what you intended).
Double == is the logical comparison for equality.
Okay then, thanks for the help!
Topic archived. No new replies allowed.