I’m developing 2D Platforming game with MonoGame, designing my levels, placing enemies etc with Tiled.
How my importer works, I use objects to place my enemies and edit HP etc.
My Tiled importer to MonoGame reads only one object with same name eg two objects with same name enemy would not work, I need to name them Enemy1 and Enemy2. I also use objects to know where the gameobjects are placed.
So, is it possible to make some kind of “prefab” (Unity term in lack of better word) out of objects, and show texture in these objects to present what enemy or object I’m placing? And also renaming them automatically?
Currently I duplicate one enemy, drag it to another place, rename it etc, which is pain because if I delete one I have to make sure I don’t screw up naming. I read object count from those object layers, so if I have Enemy1, Enemy2, Enemy4 it can’t read Enemy4 because it iterates only 3 objects, and there is no enemy object with Enemy3 as it’s name.
It would speed up development time if I have list of objects, just drag n drop them to right layer, and I’d just need to check that it is right object by looking at it’s texture.
Can I make prefabs out of objects with some kind of texture indicating what they are? Also locking of the object size?
Can I rename automatically layer objects based on their count and name/color etc pattern?
You can use tile objects instead of rectangle objects, then you could make them look like the enemies they represent. Of course your enemies may have different sizes and hence may not fit on a tileset image, but then you can instead use an “Image Collection” tileset, to which you can add individual images that can have different sizes.
I really wonder a little why you’re doing this? It doesn’t sound convenient at all. I don’t really see how Tiled could help you much either. Even if you could get it to automatically name new objects, you’d still get into trouble when deleting any object, unless some kind of code goes and renames another object to take its place in the number sequence.
This is currently not possible, though it’s something I should consider supporting since the resize handles can indeed be annoying if you need to avoid using them.
Not right now, but I imagine the functionality you’re looking for could eventually be implemented in custom scripts, once I have made Tiled scriptable.
What i tend to do as an alternative to sequential naming is to add a group property. I’ll have multiple objects with the group “dog”, and my game code keeps track of the groups and creates arrays for me. This way I have a reference to all the dogs, and if theres special handling for a certain dog i can name it “sparky” and use that to reference it (while the group remains “dog”), instead of keeping track of name changes.
typically my games will have 2 different comma delimited properties, groups and tags, example: