When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
74 messages Β· Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
you'll have to narrow it down to a specific question for us to be of any help (you didn't even ask a question)
I'm making a game in c++ and it doesn't run. I wanna ask for help to correct some of the code and where did I do somehting wrong
that's still not a question
you're making it so someone has to download and compile and run your code and see what the actual bug is
we're not going to debug it for you
@winged badge
Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.
smh smh
Have you tried stepping through your code line by line in a debugger?
If you don't know how to use a debugger or don't have one set up, we highly recommend taking the time to do so.
Debuggers are immensely helpful tools for figuring out where problems emerge in code and especially when you're first learning it can help you build intuition and understanding for reasoning through code.
Resources:
the squiggly line under driverChoice is telling you what's wrong
you also deleted your original message so we don't have your code, you should probably send it again
you haven't assigned a value to driverChoice
i like your game, you should learn raylib
like, "here's C++, you've never seen it before, make a game"?
well that's special
one thing is avoid using goto, instead try to return from a function
so far I understand some of them and some basic classes
less bugs that way
how could I do that tho
you'll learn
just write your code to rely more on values returning from functions instead of blocks of code running after a goto like
driverReturn://dito babalik pag natamaan yung goto driverReturn
if (isDriverTurn)
{
bool driverHandcuff = false;
cout << driverName + " held his gun..." << endl;
int driverInventory;
do {
cout << "\033[1;31mHealth Remaining: " << driverHealth << " HP\033[0m" << endl;
cout << "\033[1;36m=========================================\033[0m" << endl;
cout << "\033[1;36m| ~ ACTION MENU ~ |\033[0m" << endl;
cout << "\033[1;36m=========================================\033[0m" << endl;
cout << "\033[1;32m| 1. Eat orange π (+1 Health) [" << driverOrange << " left] |\033[0m" << endl;
cout << "\033[1;31m| 2. Use nail π¨ (+1 Damage) [" << driverNail << " left] |\033[0m" << endl;
cout << "\033[1;33m| 3. Handcuffs π (stun player) [" << driverHandcuffNumber << " left] |\033[0m" << endl;
cout << "\033[1;35m| 4. Shoot |\033[0m" << endl;
cout << "\033[1;36m=========================================\033[0m" << endl;
cout << "Enter your choice (1-4): ";
cin >> driverInventory;
instead, driver return could be a separate functions
and you can also store strings in vectors and print them using loops, so you aren't doing cout << endl everywhere
We generally recommend a good book to learn the necessary fundamentals:
To actually write and run C++ code, you will need a compiler, editor, and debugger. We strongly recommend to start out using an IDE, which will provide all these tools for you:
damn, I wish I could understand you bro
this is better for games so you have a million strings defined in one place
instead of all over the place
I'd suggest checking out some of these sources, since your professor doesn't sound like a good source
that stuff i said is just in general for future projects once you learn more
dont worry too much this one looks pretty good
it sounds like your first project
yeah it is
and its like big pressure cuz we need to pass it tommorow
thank you so much guys
np glad to help
thanks duke Ill check them
this looks like my first game lol
hahahahha
I think it's kinda working now brooo
Ill go check if there is some of mechanics not working
@winged badge Has your question been resolved? If so, type !solved :)
!solved