+ 2

[SOLVED]Why does the game loop get triggered?

*WARNING* the code is long. (And won't work in SL) My problem is: right when i start the game and enter the "explore" command. Its gives the correct choices and even works well going foward. BUT, whenever i enter "explore" and then enter '0' to get back to the main loop that accepts commamds, the game is ended somehow and the game_loop() function is triggered. LINE 238: where it goes wrong LINE 652: game_loop() function Not sure what i did to mess it up, but I'm sure it's stupid. All i know is i set a while loop to run and accept commands while the Player is above 0 health. There's nothing i saw that'd kill the player at the lines mentioned so I'm at a stand still EDIT: its the break at line 682 https://code.sololearn.com/c2MshQeGSO1N/?ref=app

12th Apr 2021, 12:22 PM
Slick
Slick - avatar
4 Answers
+ 1
good bro i like your game good luck broo!
16th Apr 2021, 12:53 AM
Imrane Aabbou
Imrane Aabbou - avatar
0
hi i copy your game's code and i run it in my terminal but i dont know what is exactly your problem. can you explain it well i'll help you if i can.
16th Apr 2021, 12:47 AM
Imrane Aabbou
Imrane Aabbou - avatar
0
Yo I really appreciate that 0MR4N , but i found the issue. It was a silly break at line 682! Thats the only reason i added the "EDIT" and [SOLVED] in the title. Thanks though man
16th Apr 2021, 12:49 AM
Slick
Slick - avatar
0
Greetings! Looks like a typical game state management problem. Maybe your while loop doesn't take into account some edge case that triggers the end of the game. Try checking the transition conditions in game_loop() for an unexpected change in game state or player health. Also, make sure that exits from the loop occur only when it is really necessary. And if you are interested, on the website https://mostbet-pk.pk/withdrawal/ you can find a lot of useful information about promotions and offers for bets, although you cannot play for real money there. This is a great place for those who are looking for risk-free information and want to follow the latest trends in the world of betting. Maybe it will help you take your mind off the coding and relax a bit!
23rd Aug 2024, 2:11 PM
Dave Gable
Dave Gable - avatar