(RESOLVED) HELP With Overlaying an Image on Top of Another (Image Combining)

Hello…

I am now researching how to overlay one image on top of another but I am having a hard time finding any material that could help me with this task.

What I want to do is when a user selects a tile on my map-screen I would like to highlight the border with a yellow outline.

I thought the best way to do this would be to take the original tile and overlay it with a second tile that has only the border colored in yellow with the rest of the background set as transparent.

Is there any way to do this with MonoGame so I can avoid having to load\access duplicate images and use them to replace the original image?

Thank you…

This is probably the best and easiest way to do it. In MG you can just draw the bottom tile first and then the border (by using SpriteBatch).

Jjagg…

Thank you for replying… :relaxed:

So what you are saying is just do two SpriteBatch draws to the same coordinates on the screen then; enclosing them both within the SpriteBatch.Begin and SpriteBatch.End methods?

Yes, that’s exactly right. If you do not explicitly pass a way to sort submitted sprites to SpriteBatch.Begin then it will draw the sprites in the order you submitted them. So if you draw the full tile first en then the border, the border will be drawn on top of the original tile.

Thank you so much for your help, Jjagg…

From the documents I had been researching a number of them appeared to be pointing to your resolution. However, these postings were often filled with so much other material that the issue I was trying to resolve often appeared to be clouded over.

Thank you again… :relaxed:

1 Like