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?
#16
(Feb-17-2020, 11:58 AM)Piethon Wrote: Probably I could change these numbers, to make an isometric grid. But I don't know how to change them. Do you think that could solve my problem?

I don't think so. Looking at you pics, while the individual tiles are at the proper 45degree orientation, they are blit to the screen in a straight pattern across the screen. If we look at your isometric picture and take the top as the first tile, then the next is (x =+ TILESIZE / 2, y =+ TILESIZE / 2). But your program blits at x += TILESIZE. It's just writing them across instead of at the right angle.

nilamo, might be better help with deciphering the .tmx, but I can't read it.

I think the problem needs to be fixed here:
for x, y, gid, in layer:
                    tile = ti(gid)
                    if tile:
                        surface.blit(tile, (x * self.tmxdata.tilewidth,
                                            y * self.tmxdata.tileheight))
I really think there needs to be an offset figured out to put here
x * self.tmxdata.tilewidth + OFFESET
What that is would be the problem. It might be simple. Just to test the theory, try this and see what it looks like.

surface.blit(tile, (x * self.tmxdata.tilewidth / 2,
                    y * (self.tmxdata.tileheight * 1.5) ))
It think it will show a mess, but it might let us know we are on the right track. I suspect that in the end that the OFFSET will have to be a complex variable that tracks the rows and offsets the starting position, but who knows... that might fix it.
Reply


Messages In This Thread
RE: How to display isometric maps with pytmx? - by michael1789 - Feb-18-2020, 06:51 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,356 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