1
\$\begingroup\$

I created a level in the 'Tiled Map Editor' and loaded it into my libGDX game. I can easily transform almost all objects into Box2D objects (although this problem is not Box2D specific), but I have trouble with ellipses.

Tiled seems to only create ellipse objects, without a special case for circles. I'd be happy with just circles if they existed in Tiled.

However, even the EllipseMapObject I load in libGDX only has an x,y position. I don't see any information about area or vertices. Did I miss something? How can I create circle or ellipse objects in Tiled and load them into libGDX with right dimensions?


Tiled version 0.10.1, libGDX version 1.4.1

\$\endgroup\$
5
  • \$\begingroup\$ Are you using some specific Tiled map loader in libgdx, or your own file parser? \$\endgroup\$
    – Anko
    Commented Oct 24, 2014 at 9:07
  • \$\begingroup\$ The TMX is loaded via the build-in parser of libGDX \$\endgroup\$
    – Marco
    Commented Oct 24, 2014 at 9:18
  • \$\begingroup\$ Tiled's file format (.tmx) includes width and height fields for ellipses since v0.9.0, which carry over to within your EllipseMapObject. Are you sure you're looking in the right place, calling EllipseMapObject.getEllipse() and checking width and height on that? \$\endgroup\$
    – Anko
    Commented Oct 24, 2014 at 9:29
  • \$\begingroup\$ I think you are right @Anko, the values are there. Tiled adds objects by default with size 0. And I got confused, since this is (of course) irrelevant for polylines and polygons. So setting a proper size in tiled also shows these values in the EllipseMapObject. \$\endgroup\$
    – Marco
    Commented Oct 24, 2014 at 9:35
  • \$\begingroup\$ OK, good. You could add an answer to summarise the situation for later visitors with the same misunderstanding, if you want. \$\endgroup\$
    – Anko
    Commented Oct 24, 2014 at 9:52

1 Answer 1

1
\$\begingroup\$

The 'Tiled Map Editor' sets the size (width and height) of map objects by default to 0.

For most objects this is not relevant (polylines, rectangles and triangles which are handled as polygon objects) since the vertices are important. But for circles and ellipses I had to set a real value of course.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .