0

I'm working on my first game in Pygame and I want to make a Tiled Map. How would one properly go about do this?
What I'm thinking of is just loading a tile and keep blitting it next to one another using a loop.

timss
  • 9,982
  • 4
  • 34
  • 56
NahTroTro
  • 1
  • 1
  • 2
  • you typically start with a 2d array of integers that map to indexes in an array of tiles that you then blit in a loop – Joran Beasley May 16 '13 at 23:40
  • Here's an example: http://stackoverflow.com/questions/12663764/how-to-load-an-image-to-a-grid-using-pygame-instead-of-just-using-a-fill-color/12665286#12665286 – ninMonkey May 17 '13 at 05:51

3 Answers3

0

If you are good in javascript, then I would strongly advise in porting polymaps, which is tiny javascript based mapping/tiling library into python. You just need code which handles creating a proper tile, then you could load data inside tile in any way you see fit, here is a good example http://polymaps.org/ex/tiles.html

varun
  • 4,522
  • 33
  • 28
0

You can use tiled editor (www.mapeditor.pl) to make a tiled map from prepared earlier tiles (choosing "new map" in tiled you can specified map and tiles size), than you can export your map to tmx format and load it to python using pytmx. You can also export your map to ascii file and write parser which load your map and render tiles.

BoatX
  • 153
  • 1
  • 6
0

Not sure if this is much of a help now but you could try this:

for x in range(20): # Creates 20 tiles
    for y in range(20:
        surface.blit(tile, (x,y), 2)

this will create 20 X 20 box's then you just need to figure out how to move the rows and columns

Dextron
  • 598
  • 7
  • 24