question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Read "Type" and "Probability" as first-class citizens for a Tile (.tmx)

See original GitHub issue

Issue details

Currently, type is not being read by BaseTmxMapLoader, even though it is a base property of a Tile. Furthermore, probability is being read, but simply put in the tiles’ Properties. It would be a good idea to ‘promote’ these base fields to Tile.

Reproduction steps/code

In Tiled, configure a tile map: image

Notice that this will produce some output like:

...
<tileset firstgid="1" name="grass-tiles-2-small" tilewidth="32" tileheight="32" tilecount="72" columns="12">
  <image source="grass-tiles-2-small.png" width="384" height="192"/>
  <tile id="13" type="Grass" probability="0.5"/>
</tileset>
...

Version of LibGDX and/or relevant dependencies

All versions.

Notice that they are not first-class citizens in BaseTmxMapLoader.java lines 608 - 620:

for (Element tileElement : tileElements) {
	int localtid = tileElement.getIntAttribute("id", 0);
	TiledMapTile tile = tileSet.getTile(firstgid + localtid);
	if (tile != null) {
		AnimatedTiledMapTile animatedTile = createAnimatedTile(tileSet, tile, tileElement, firstgid);
		if (animatedTile != null) {
		        animatedTiles.add(animatedTile);
			tile = animatedTile;
		}
		addTileProperties(tile, tileElement);
		addTileObjectGroup(tile, tileElement);
	}
}

Please select the affected platforms

  • Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Timvisser1994commented, Jun 14, 2021

Closing Issue

0reactions
Timvisser1994commented, Jun 14, 2021

@lyze237 Should I open up another Issue to also support type?

Read more comments on GitHub >

github_iconTop Results From Across the Web

TMX Map Format — Tiled 1.9.2 documentation
TMX and TSX are Tiled's own formats for storing tile maps and tilesets, based on XML. TMX provides a flexible way to describe...
Read more >
TiledMap tile property "Type" doesn't get loaded #6464 - GitHub
Issue details The Type property on tiles gets skipped during loading and therefore isn't available in libgdx.
Read more >
A guide to level creation with Tiled [ + how to use it ... - YouTube
A video about Tiled, including terrains, isometric tiles, exporting and objects. I also cover how to import the resulting data into Pygame.
Read more >
Simple TMX Library documentation - PythonHosted.org
This library reads and writes the Tiled TMX format in a simple way. This is useful for map editors or generic level editors,...
Read more >
Tiled Documentation - Read the Docs
Tiled is a 2D level editor that helps you develop the content of your game. Its primary feature is to edit tile maps....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found