Hi! I'm new in the forum, and I need help with my project.
I created a map for my game with Tiled, but when drawing, I get this..
Which is the problem? Any idea?
Are the trees and the gras on the same layer?
No, the grass stay in "ground" layer and trees stay in "collision" layer.
Is the background of your trees transparent or black? I mean in the image file.
and Check your spriteBatch.Begin(....) the Blendstate might be the problem here.
In Photoshop I see transparent background.
I copy the code from this example:https://github. com/craftworkgames/MonoGame.Extended/blob/develop/Source/Demos/Demo.Platformer/GameMain.cs(I can't insert more of 2 links D: )
This example not use the spriteBatch.Begin(....) to draw the map
The rendering doesn't use SpriteBatch. You need to change the blend state between drawing layers.
Ahh.. but, how can I change the blend state of the layer? Sorry for my ignorance, I'm so novice in this version of library
// Render state to ignore transparency; transparent or translucent parts of images don't get alpha compositing.
GraphicsDevice.BlendState = BlendState.Opaque;
//TODO: Draw stuff that doesn't need transparency like ground layers or tiles that don't have any transparent parts.
// Render state to enable transparency; transparent or translucent parts of images do get alpha compositing.
GraphicsDevice.BlendState = BlendState.AlphaBlend;
//TODO: Draw stuff that has transparency like mask or fringe layers.
I can fix the problem, I hadn't this line in my code: "GraphicsDevice.BlendState = BlendState.AlphaBlend;"
Thanks for your help!