1
\$\begingroup\$

I am using Tiled map editor. I am trying to add static spawning locations (x,y) for various entities (lets say 15) in my game. The best idea I had so far is something like this:

1

I am using a polygon collider named Player to declare the spawn location of the player. The width and height of this box is irrelevant. I have placed all "spawning colliders" in the same layer. I am using the Name tag to identify the type of the object.

This works fine, however, inside the editor, I would like to be able to see the type of entity (Player, monster, item, etc.) without having to select the polygon collider and look at the Name tag each time.

If I continue doing this I am going to end up with 100 grey boxes one next to the other. Is there any way of adding an indication on the collider that would represent its type (Player, monster, item, etc.) ?

\$\endgroup\$
2
\$\begingroup\$

One thing you can do is to use multiple layers. Instead of using the Name tag of the object/collider to identify the type of the entity to be spawned, you use the layer name, so you would have Player-layer, Monster-layer, Item-layer etc (and everything in that layer is implicitly of the type specified by the layer).

Then you can set the Color of the layer, in the layer properties to a different color for every entity.

Another advantage with this is that you can hide layers you don't want to see during editing.

\$\endgroup\$
  • \$\begingroup\$ Not a bad idea at all \$\endgroup\$ – dimitris93 Jul 10 '15 at 6:45
  • \$\begingroup\$ I haven't tried it myself yet, I will in my next game though because in my current one I am using the same method you describe and it makes editing some of my levels messy as can be seen here; forums.tigsource.com/… \$\endgroup\$ – bornander Jul 10 '15 at 6:51
2
\$\begingroup\$

If you would use the Type field instead of the Name field, then you could set a color for each type of object in the preferences. It would also autocomplete in this field for the types you have defined.

But maybe a better way to make your objects visually more recognizable, especially when the size is irrelevant, is to use tile objects instead of rectangle objects. That way you can use any image for your objects and you do not even need to repeatedly set any name or type on them. Instead, you could put this property just on the tile.

\$\endgroup\$
  • \$\begingroup\$ That's also a very good solution. The problem with using tile objects was that when I saved the map and then imported it to LibGDX it was requiring the images of those tiles as well. \$\endgroup\$ – dimitris93 Jul 10 '15 at 19:01
  • 1
    \$\begingroup\$ Ah, yes, would be nice if libgdx would provide a way to avoid loading images unnecessarily. In general I would suggest loading images lazily, but then again Tiled does not do this either (but it's something I'd like to change). \$\endgroup\$ – Thorbjørn Lindeijer Jul 12 '15 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.