Are Global variables ok in this scope?

时间:2015-07-13 21:01:36

标签: python pygame global-variables

As (nearly) any programmer else, also I'm a member of the 'No Global Variable' fan club, but in some cases I really don't know another, maybe also better way for solving a problem.

For example at the moment I'm programming a game in Pygame and I've got a mouse class which for example holds the actual mode, like select, aim or move. Of course I have to change that mode several times and also in several functions, so here is the problem, if the mouse-object isn't global, I really don't know how I could 'sync' the object in the different functions.

Maybe you could give me a hint how to solve that problem or if not you say 'I that case global variables are great full' anyway please say at least one of these two things :)

Leon

0 个答案:

没有答案