PyTMX is a Python library to read Tiled Map Editor's TMX maps.
Questions tagged [pytmx]
40 questions
1
vote
1 answer
How can I reduce the lag and CPU usage in pygame? (pytmx is used for loading the map)
I have a problem with massive lag in my game. My game has a map that is quite large. The map is 250x250 tiles. Each tile is 32x32. Note that I'm using an older laptop. When I open a task manager it says that my CPU usage is up to 50%, but the memory…

Vladimir Avramović
- 11
- 1
1
vote
1 answer
Scale tiny TileMap to a larger size in PyTMX and PyGame
So I managed to create, import and display a 16x16 TileMap in my PyGame project.
I have my asset layer called ground and an Objects layer originally called objects.
Tile software screenshot with my layers
Then I've got this simple code to create my…

Anorak
- 41
- 5
1
vote
0 answers
pygame game crashes when I edit tilesheets in tiled
I am trying to make a game with pygame using tiled. When I edit tilesheets (to for example add collision) I get a bunch of error messages when I run my code.
When I use the same tilesheet without editing I get no errors and all the files…
user10695297
1
vote
0 answers
TypeError when running pyTMX in pycharm (pygame)
I am trying to use pyGame and pyTMX in pyCharm; however, I am getting an annoying error message whenever I try to run the program.
The following code was
def get_tile_properties(self, x, y, layer):
""" Return the tile image GID for this…

Ryan
- 11
- 2
1
vote
1 answer
Sprite moving faster left than right pygame
I think I'm having a rounding problem causing my sprite to move faster/jump farther while moving left.
My sprites update method is calling move, which calls move_single_axis for each axis. Inside this I'm doing some collision detection where I rely…

davidahines
- 3,976
- 16
- 53
- 87
0
votes
0 answers
Collisions in Tiled
Can we make Tiled Layer Collisions work in a game based on Tiled Tile Layers rather than Tiled Object Layers?
Tried:
for object in self.map.tmxdata.objects:
if object.name == 'Collision':
Obstacle(self, object.x,…

Groot
- 1
- 1
0
votes
0 answers
Camera with Pytmx and pygame?
So far with my map I have gotten to blitting the tiles and getting collisions with them. But the thing is my map doesn't work with my previous camera setup, so I have to turn it off to see my player on the tiles. Basically whats happening is that…

Quantum
- 21
- 3
0
votes
0 answers
How do you handle collisions in PyTMX?
Using the module pytmx I have gotten as far in my map as blitting it to the screen, But now I have a different problem... Collisions. I tried to make a tile class and assign an image and a rect, and then append the rect to the list I was using to…

Quantum
- 21
- 3
0
votes
0 answers
Pygame : Pyscroll & Pytmx working on Tiled - Isometric map
I'm doing a game with python : pygame and pytmx, pyscroll with TiledMap, I know how to do orthographic map with pyscroll like
tmx_data = pytmx.util_pygame.load_pygame("Map.tmx")
map_data = pyscroll.data.TiledMapData(tmx_data)
map_layer =…

Kuyakii
- 1
- 1
0
votes
1 answer
Player sprite not behind isometric tiles
I am currently trying to learn how to use isometric maps in a game environment. I'm using Tiled Map Editor to create a map and PyTMX and Pygame to read and use the information. I am currently making the maps in layers and treating them as big…

eezageeza
- 38
- 6
0
votes
0 answers
Pygame/Pyscroll: TypeError: Source objects must be a surface
So, I have a "MapClass.py" file, with inside a "Map" dataclass and a "MapManager" class :
import dataclasses
import pygame
import pytmx
import pyscroll
@dataclasses.dataclass
class Map:
name: str
walls: list[pygame.Rect]
group:…

Cold Fire
- 91
- 5
0
votes
1 answer
Rendering and refreshing tmx file map with python and pytmx
I am using pytmx to load my map with pygame, but some items needs to be set as sprites and displayed above the surface, so the layering doesn't stay, I will show you 2 examples, one with the player displaying on top of decorations (where the point…

SnK
- 58
- 1
- 6
0
votes
1 answer
Pytmx rendering animated tiles from Tiled map
So I have been working on a project for some time now and I realy wanted to get animated tiles in to the game. Im creating a 2d pixel art styled game with pygame and Im using the an editor called Tiled to create the map. Tiled generates a .tmx file…

Theo Esberg
- 3
- 2
0
votes
2 answers
Tiled / pytmx - Problem with getting same gid for same image in different maps
I always getting gid == 1 for first element in maps, even with same tileset.
Saved file "example.tmx" have value encoded with CVS.
I open file with txt editor and it's look like this:
24,24,19,24,24,22,19,23,18,23,2
...
This…

Maucin
- 1
0
votes
1 answer
No module named 'pytmx' but pytmx is installed
I am learning a Python Pygame tile-based game via a YouTube tutorial series https://www.youtube.com/watch?v=QIXyj3WeyZM
My code is identical to the code in the video. (I have checked many times for mistakes.)
When I run the program, I get this…

360yogi
- 3
- 2