Re: I need help, again!
@post 55, thanks, that worked.
Now: To a question of a different nature.
Suppose I'm building an idel gathering game. Let's assume that we'll use a list for storing our resources. We'll use index to iterate and move through the list. The problem? The index doesn't keep it's value. what I mean is this:
index = 0
def addtoindex(index):
index+=1
That code won't work. It will simply assign a value to a variable called index and won't update the index I declared above the function. However, this will work.
index=0
def index():
global index
index+=1
The problem I'm facing? Well, it's the global part. I don't want to do global x, global y, global z every time I want to change a value. That seems highly redundent. I could do return statements, but what if I don't always want to break a function by returning?
While I am not building a game per say, I still am trying to learn sounds and other concepts, and this is another problem I ran into. So tips? Suggestions? Am I stuck with globals or return statements and there's no other way?
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector