New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tiled] Work on Object Layers #125
Comments
Okay cool. So the Essentially, you'll need to implement the bits for the the Content Pipeline first. For example, the That's how the raw TMX file gets compiled into an XNB file for MonoGame to load when you call Have a go at it and PR changes into the |
Ok, I think I got it. I see that you have done half of the way. How can I debug the |
Yes, debugging these things is rather difficult. The only way that I've found that works kind of okay is unit tests. I've got some Tiled Map Importer tests already that you should be able to use. You should be able to put a break point in the test and run it in debug mode to step through the code and see what's going on. |
Nice. I have a question. In the
But how do you store them? @edit: wops, forget, already understand it :P |
When you pass a list into a method it gets passed by reference.
So in this case, when you call In hindsight this is a very strange thing to do in C#. Normally I would frown upon code like this. Maybe it would be better to change it so that
Would that make more sense to you? |
I think the reason I did it that way was to maintain a private setter on the Properties properties.
If you did it the other way we'd have to change them to public setters, meaning they could potentially be set to |
The second way is more understandable, but I think the first is acceptable, there's nothing wrong changing directly the list. |
I wrote all the stuff to read the objects, but I cant build the .tmx file. Even before I do any change in the code, I receive this error:
The line 438 of the .tmx is this:
Context:
EDIT: solved the issue, the |
I think the only thing left to do on this is add it to the Tiled Maps demo project. |
I think this issue need be fixed: The values from XML can't contains points.
Acceptable.
Unnaceptable, raises an error. I know the error comes from
Result: |
Yes, this is very weird. Maybe it's got something to do with how the XML deserializer works? Maybe try doing some googling and see if you can find others with this issue. |
Nevermind. I worked it out. The problem is actually in
Should be:
I'm working on this now. I'll have something checked in shortly. |
I've committed the initial fix but I noticed a number of other properties are not being read and written. In other words, there's still plenty of stuff to do before object layers are fully supported. I'm going to keep working on this whenever I get spare time. |
Almost everything is done on this now. All of the properties for object layers are being loaded. The only thing left I'd like to do is add the ability to render the object layers to the screen. Rendering shapes would be an option, but turned off by default. |
@craftworkgames, I'm looking to finish up the last bit of work here but wanted to revisit your comment on drawing the objects. I agree we should be rendering any objects created as part of "Insert Tile" on the object layer however it was my interpretation that shapes were not a visual construct and shouldn't be rendered outside of the Tiled editor. I think the fact that there's no way to customize how they appear (color, fill, border thickness) in the Tiled editor supports that. If you still think we should support drawing the shapes I can certainly implement that as well but I wanted to check first. |
I'd rather not clutter up the renderer with shape rendering code.. However, there is one use case that makes sense to me and that is when you're trying to debug a problem. Now that we have the ability to have multiple renderers I wonder if it might make sense to have a debug renderer separate from the "normal" renderer. If you're super keep to do it you can, but I'm happy to leave it out for now. |
Nope, you pretty much summed up how I feel I just wanted to make sure I did everything required to close this issue. I'll finish up rendering of tiles in object layers and submit a PR. |
Sorry for the late reply. This is exactly what I was going to say. You beat me to the punch 👍 There's probably going to be lots of creative ways people will want to use the editor. We don't have to support anything and everything but it's nice to make a few things configurable to allow for this. One the nice things about doing spawn points this way is that you can see in the editor how things are going to look and fit together. It's a nice level editing experience. There's obviously going to be other reasons people want to place tiles as objects though, so I think you made the right choice. |
I need use the object layers but they haven't been implemented yet. How can I work on this? I am trying to understand the TileMapReader.cs but I can't understand the
ReadInt32()
or other read stuff. Where I begin?The text was updated successfully, but these errors were encountered: