Jan-20-2018, 07:15 PM
It is because of variable scope. When you enter one of the functions (games), credits variable defined on top of your file is used. If you modify credits, it only stays modified as long as you are inside the same function. Once a function (game) exits, whatever you were doing with credits locally is lost. And next time when you enter a new function/game, credits is 10000 again, because that is how it is defined globally.