[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Sprite Collision
Dave LeCompte (really) wrote:
Actually the correct syntax to address an element would be:
passible_at[x][y]
Not thinking in Python this morning ;^)
Another option is to use a one-dimensional list, which might be slightly
faster. In my game instead of doing:
tiles = []
for y in range(foo):
tiles.append([])
for x in range(bar):
tiles[-1].append("something")
...which gives a list of lists, I do:
tiles = []
for y in range(foo*foo):
tiles.append("something")
It's then addressed at any x,y location by:
tiles[y*foo + x]
Kris