Sorry to be a pain again guys, but I’m not sure how to approach my problem.
Let me explain quickly:
I create 2 random numbers, but I want to build a filename based on that and then need to blit that to the screen, for example:
rand1 = random.getrandbits(2)
rand2 = random.getrandbits(3)
filename = "graphic" + rand1 + "_" + rand2
So the real filename would look like:
screen.blit(file.graphic3_5, x, y) etc...
but in my example above, I want to be able to do
screen.blit(file.filename, x, y)
I tried to change the surface object names to:
parts = []
parts[0, 0] = upygame.surface.Surface(12, 12, parts0_0Pixels)
but then I get an error “int object doesn’t support item assignment”
Then I tried:
parts[0][0] = upygame.surface.Surface(12, 12, parts0_0Pixels)
but then I get an error “list object isn’t callable” or something to that effect.
As it is right now, it works like this:
parts0_0 = upygame.surface.Surface(12, 12, parts0_0Pixels)
and I can blit it with screen.blit(file.parts0_0, x, y)
Just so you know, the “file” bit is the include at the top as I keep my graphics separate from code.
Hope this makes sense to someone. If this can’t be done, any other solutions?