Counseling Needed. I'm a newbie trying stuff, sometimes this is confusing

Salutations, everyone!
So I just finished Setion_02 and scratched the surface of Section_03. Then I had an idea and decided to make my own console game, like Bulls and Cows. But my game is called Find Me! It it pretty simple, at least in my head, heh.
So here it goes,
the game starts with a text explaining that you’re alone in a dark cave and have only three options: going right, left or forward, then it tells you your proximity to the objetive(that Proximity value is the value responsible for winning or losing the game, I’ll get there).
The game works with the player typing an input i.e. ‘left’. This triggers a response that gives the player one of three possible destinations(‘rooms’ for future reference). Once the game describes a new room to the player it will give the player their new Proximity value based on the new room(either add 1 [getting closer to objetive], subtract 1 [getting farther away from objective] or add 0/nothing [maintaining distance to objective]). The game ends when the Proximity value reaches 10(win! you found the objetive) or 0(lose. you went too far away from the objective and died).
I hope that’s understandable, I’m trying my best to explain it here.
This is the first actual programming I’m doing all by my own after taking the course lectures and I’m hitting some walls. I’m hoping someone there’s willing to take a look at my code and give me some feedback. Tell me if I’m on the right path(or not), maybe point me in the right direction, or if I have a lot of nonsense typed in VS, heheh, or generally just give it a look and give me some pointers… Any at all would be greatly appreciated. I’m hitting some pretty big walls here.
And just for the record, there may be some unfinished lines or functions in my code, or really unnecessary stuff, but that’s pretty much why I’m posting this, I don’t know that much to know these things. I’m a complete begginer. :smiley:

EDIT: Finally got my code on github.
Project code files

So, thanks in advance to anyone wiling to take a look at this!
Have a nice day!

First of all i’m in no way, shape or form an expert on c++ but I think you have a good start here, if there is any part of it you want help with just ask and I will do my best to help :slight_smile:

I did find a spelling error tho,
On line 45 of main.cpp it says “You can only do in one direction at once,” im guessing it should be go and not do :yum:

Hey, thanks for the reply!
I’m really glad someone thinks this is, at very least, a good start. :smiley:

The part I’m having most trouble with is coming up with with a way that when the game gets the direction input from the player i.e. ‘left’(perform a check, if it’s invalid, print someting like “Please type a valid direction.”), if the player’s input is valid, then it will print one of three pre-stabileshed blocks of text describing a new room and adjusting the Proximity counter accordingly. Also, thanks for telling me about the spelling error, that one passed straight above my head, heheh.

One way I can think of doing it would be if you made maybe a struct with a left/right/up value that you send along to WhereIsPlayer, and then say if it’s left you generate a number between 1-3 and print out a different room depending on the number.

I’m sure there is a much better way of doing it, but I think this is atleast a kinda easy way to get it to work.
Hopefully you understand what I mean, i’m not the best at explaining things :joy:

Don’t worry I think I got what you mean! :smile: I’ll try to do something along these lines as soon as I can, then I’ll post it here.

Not sure if this applies to c++
However in the unity course there is something similar made in section 3 I believe with rhe use of state machines. Basically using if else statements. For example you could use
This is unity code so may not be the same
MyState = room_01

Just a thought, it may or may not work, but worth a look in

On phone so excuse the formatting :expressionless:

Should answer your questions,Its handled differently when using unreal editor as the engine has inputs there already this should help for pure C++ though

Privacy & Terms