Aug-06-2017, 07:55 PM
It's not leaving the loop because you never change gameRun. You only change gameTrue, not gameRun. Furthermore, you are only changing gameTrue within the checkX function. Even if you changed that to gameRun, it would be a different gameRun. This is called the scope of the variable. What you need to do is put the following line at the end of the definition of checkX:
return gameTrue
. That will make the value of any call to checkX the value of gameTrue when it ran. Then, in your loop, change the call to checkX to gameRun = checkX()
. That will change gameRun to False whenever someone wins the game, ending the game
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures