Some images displayed with weird offset ingame

Hello,
in the image bellow you can see 2 sprites that belong to the same layer. A box and a gate. They are both created the exact same way and have the exact default pivot set in game. In axmol the origin is bottom left, while in Tile is up left, so I set the pivot to (0, -1) in axmol and everything works as expected.
But, for some reason the gate image is not showing properly

I think I know what might be happening. When I first dragged and dropped the gate image in my tilset, it has a smaller height. Then I redesigned the gate image incrementing its height, saved it, and updated it in Tiled (ctrl + T).
But as you can see it doesn’t show in the same position in the game, and the offset mismatch is suspiciously similar to the difference of heights between the original and the redesigned images.

Thoughts?
thanks

1 Like

The image in Tiled also appears to be squished compared to the one in your game. In Tiled, Tile Objects have a width and height that defaults to the size of the tile when they’re placed, and changing the size of the tile they’re using will not automatically update their size AFAIK.

It sounds like your game isn’t correctly reconciling the object’s width/height with the tile’s width/height.

Also, for easier dealing with Object coordinates, you may want to use the Top Left Object Alignment setting in Tiled. This is something you can change on your Tileset(s). This way, you don’t have to have a position or pivot mismatch between your game and Tiled.

1 Like

True, I didn’t notice that it was squished. I am trying to remove the gate image from the current image collection tileset to drag and drop the new one, but I don’t know how to remove an existing image. I did a search here but maybe I am using the wrong words because I don’t see any post about it.

1 Like

There is a “Remove Tiles” button next to the “Add Tiles” button in the toolbar. They are shaped like a minus and a plus, respectively. “Remove Tiles” removes selected tiles from the tileset. It does not automatically remove references to them from your maps however, as far as I know.

1 Like

oh, cool. It’s in the tileset property edit tab. I was trying to remove it in the tileset view tab.
Yeah, that solved it. I’ll just have to remember dragging and dropping the image again if the image size changes. Other engines didn’t have an issue with that? Not sure if axmol have a feature to update properly in that case, I’ll have to investigate.

Thanks

1 Like

The problem is probably with Tiled not updating the Object size when the tile changes - Tiled currently has no way to distinguish a deliberately set object size from an incidentally set one. So, it’s possible the other engines actually had different problems, such as entirely ignoring the object size set in Tiled.

When replacing a tile image with a different one, it’s usually a good idea to replace the image in the Tile rather than create a new tile, so that your existing uses of the tile don’t become invalidated. The problem is that you then may need to update the sizes of the Tile Objects created with that tile.

Also, the “tileset property edit tab” is called the Tileset Editor, it’s where you edit the Tileset in general, not just its properties. Conversely, when you’re viewing a map document, you’re in the Map Editor.

2 Likes

I was going to ask if I could replace just the image. I only see a replace tileset which seems to replace the entire tileset and not just the one image? I am scared of using it in case mess up my current work.
I realized I have the same issue with other images, so I drag and dropped again, and as you mentioned, they loose reference to the image. They still show properly in the game, but not in Tiled

1 Like

If the old tiles show properly in the game, it’s probably because the old version of the Tileset is cached somehow. Perhaps that’s also connected to why the gate looked wrong before. This is an issue you’ll need to work out with your game/engine, it’s not anything Tiled does.

You can replace just the image by editing the Tile in the Tileset Editor. As always, any changes to the tileset happen in the Tileset Editor, you cannot edit the Tileset in the Map Editor.

You can also right-click a Tile Object with the new tile selected and select “Replace Tile”. This will change the tile associated with the Object to the new one. This is completely different from updating the Tile’s image, but can be useful.

2 Likes

Awesome! that did it. Thank you.

1 Like