Python Forum
How to display isometric maps with pytmx?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to display isometric maps with pytmx?
#17
The offset is definitely the way to go. I opened the map, and re-saved it using csv instead of base64, so you can see how it's organizing the tiles. The file itself has no direction whatsoever of how to format the tiles, and pytmx doesn't help there, either.

I think what you want to do, is calculate how many tiles are in each row, which you can use to determine the offset (offset is based on the width of the tiles*number of tiles), and try to format it that way. I can't test it right now, but I'll try to try it out tonight.

The file:
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.2" tiledversion="1.3.2" orientation="isometric" renderorder="left-down" compressionlevel="0" width="16" height="16" tilewidth="64" tileheight="32" infinite="0" nextlayerid="8" nextobjectid="1">
 <tileset firstgid="1" source="outdoor pack.tsx"/>
 <layer id="1" name="Ground" width="16" height="16">
  <data encoding="csv">
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,31,11,11,11,
11,11,11,11,11,31,11,11,13,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,31,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,13,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11
</data>
 </layer>
 <layer id="2" name="Floor" width="16" height="16">
  <data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,175,175,175,175,175,175,175,175,0,0,0,0,
0,0,0,175,175,175,175,175,175,175,175,175,0,0,0,0,
0,0,0,175,175,172,172,172,171,175,175,175,175,0,0,0,
0,0,0,175,0,0,0,0,0,0,175,175,175,175,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,175,175,175,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
 </layer>
 <layer id="3" name="M1" width="16" height="16">
  <data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,256,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,240,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,273,0,0,0,0,0,0,111,0,0,
0,0,0,0,0,0,0,0,0,0,256,0,0,0,0,0,
0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,94,0,
0,0,0,0,0,0,251,0,0,0,0,0,0,0,0,76,
0,0,0,0,0,0,0,0,0,0,0,0,93,0,92,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
 </layer>
 <layer id="4" name="M2" width="16" height="16">
  <data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,230,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,263,0,0,0,0,0,0,101,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,84,0,0,
0,0,0,0,0,0,241,0,0,0,0,0,0,0,66,0,
0,0,0,0,0,0,0,0,0,0,0,83,0,82,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
 </layer>
 <layer id="5" name="M3" width="16" height="16">
  <data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,253,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
 </layer>
</map>
Reply


Messages In This Thread
RE: How to display isometric maps with pytmx? - by nilamo - Feb-18-2020, 07:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Isometric game pygame Tiled howardberger 1 670 Jan-31-2024, 10:01 PM
Last Post: deanhystad
  [PyGame] Isometric Movement on Tiled Map Josselin 0 2,398 Nov-02-2021, 06:56 AM
Last Post: Josselin
Thumbs Up [PyGame] Simple code for isometric 2D games ThePhi 1 15,399 Nov-17-2020, 12:58 PM
Last Post: mattwins
  [split] How to display isometric maps with pygame? mattwins 6 6,357 Nov-17-2020, 12:54 PM
Last Post: mattwins
  Problems with pytmx Piethon 15 9,572 Jan-05-2020, 10:44 AM
Last Post: Piethon

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020