Jasper ha scritto:
Richard Jones wrote:
On Wed, 5 Sep 2007, pistacchio wrote:
maps are certainly a very common feature in game development. the
easiest way to trace maps (and the one that i've used in other
languages
in tha past) is to use multidimensional arrays. so, a tile-map, can be
Jasper ha scritto:
Richard Jones wrote:
On Wed, 5 Sep 2007, pistacchio wrote:
maps are certainly a very common feature in game development. the
easiest way to trace maps (and the one that i've used in other
languages
in tha past) is to use multidimensional arrays. so, a tile-map, can be
The dictionary approach is what I use as well. It has some nice
touches, such as the ability to have non-square maps without using
this cell is illegal filler, and the ability to work in special
case cells that are outside of the standard grid coords. The
resulting code tends to be more
Richard Jones wrote:
On Wed, 5 Sep 2007, pistacchio wrote:
maps are certainly a very common feature in game development. the
easiest way to trace maps (and the one that i've used in other languages
in tha past) is to use multidimensional arrays. so, a tile-map, can be
stored and worked on as
maps are certainly a very common feature in game development. the
easiest way to trace maps (and the one that i've used in other languages
in tha past) is to use multidimensional arrays. so, a tile-map, can be
stored and worked on as a simple array (or list) that goes like this:
You can use lists of lists, for example with a function like
def makearray(w,h):
a = []
for i in range(w):
a.append([None]*h)
return a
Then you adress the elements like a[2][3]. This is probably not very
efficient, but for maps it should be ok.
Ulf
On Wed, 5 Sep 2007, pistacchio wrote:
maps are certainly a very common feature in game development. the
easiest way to trace maps (and the one that i've used in other languages
in tha past) is to use multidimensional arrays. so, a tile-map, can be
stored and worked on as a simple array (or
pistacchio wrote:
tile_map[x][y] = tile_number
now, probably i'm missing a basic feature of python, but it seems to
lack of a native support for multidimensional arrays.
There's nothing built-in (yet -- there might be in py3k).
If you just want to be able to write x[i,j] instead of
Richard Jones ha scritto:
On Wed, 5 Sep 2007, pistacchio wrote:
maps are certainly a very common feature in game development. the
easiest way to trace maps (and the one that i've used in other languages
in tha past) is to use multidimensional arrays. so, a tile-map, can be
stored and worked