0

I have a problem with tiled map object:

I created a rectangle object by tiled map editor. When I render the map in Libgdx I want to create a text(using font) on this rectangle. For this reason I get the rectangle's coordinates x,y and create the text in this position. My problem is that the text doesn't visualize in the position that I see in the tiled map editor and if I move the rectangle in other position it doesn't render on the screen.

How Do I solve this problem?

My code:

String textToSet=(String)properties.get("rectangle");
float x=(float) properties.get("x");
float y= (float) properties.get("y");

batch.begin();
font.draw(batch,textToSet,x,y);
batch.end();

1 Answers1

-1

What do you mean by "position that I see in the tiled map editor"? Do you mean tiles? You may have to convert your coordinates.

i.e.

x/tilesize y/tilesize

If you are looking at its position in pixels in tiled map editor then i don't know. But see if this is the problem you were having.

Lucas B
  • 338
  • 4
  • 14