You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone,
I'm still rookie in programmation, but i decided to deeply understand pytmx for a personnal project.
self.map is my TileMap, i'm actually trying to get tiles's images of my map in the code in this way :
for gid in self.map.tiledgidmap.values() :
print(gid) #work well, i got all the gid like in the .tmx file
image = self.map.get_tile_image_by_gid(gid) #here the error
print(f"gid {gid} : {image}")
but i got an error with the method get_tile_image_by_gid() that i still dont understand after several hour of debugging ^^'
Actually I did all the checking chatGPT advice me and all "should" be working
Traceback (most recent call last):
File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytmx\pytmx.py", line 717, in get_tile_image_by_gid
return self.images[gid]
~~~~~~~~~~~^^^^^
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\rvvr4\OneDrive\Bureau\Programmation\pygame\towerdef_tiles\main.py", line 45, in
app = App()
^^^^^
File "c:\Users\pygame\game2\main.py", line 16, in init
"nature": Tile(self.screen, "tile_1.tmx", x=0),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\pygame\game2\tile.py", line 36, in init
image = self.map.get_tile_image_by_gid(gid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytmx\pytmx.py", line 724, in get_tile_image_by_gid
logger.debug(msg.format(gid))
^^^^^^^^^^^^^^^
IndexError: Replacement index 1 out of range for positional args tuple
here the code => files in good dir, class Tile and tile.tmx (forget line 37,38)
The text was updated successfully, but these errors were encountered:
Hello everyone,
I'm still rookie in programmation, but i decided to deeply understand pytmx for a personnal project.
self.map is my TileMap, i'm actually trying to get tiles's images of my map in the code in this way :
but i got an error with the method get_tile_image_by_gid() that i still dont understand after several hour of debugging ^^'
Actually I did all the checking chatGPT advice me and all "should" be working
Traceback (most recent call last):
File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytmx\pytmx.py", line 717, in get_tile_image_by_gid
return self.images[gid]
~~~~~~~~~~~^^^^^
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\rvvr4\OneDrive\Bureau\Programmation\pygame\towerdef_tiles\main.py", line 45, in
app = App()
^^^^^
File "c:\Users\pygame\game2\main.py", line 16, in init
"nature": Tile(self.screen, "tile_1.tmx", x=0),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\pygame\game2\tile.py", line 36, in init
image = self.map.get_tile_image_by_gid(gid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytmx\pytmx.py", line 724, in get_tile_image_by_gid
logger.debug(msg.format(gid))
^^^^^^^^^^^^^^^
IndexError: Replacement index 1 out of range for positional args tuple
here the code => files in good dir, class Tile and tile.tmx (forget line 37,38)
The text was updated successfully, but these errors were encountered: