Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I apologize for the vague title, I'm not sure how else to phrase this problem.

I am using tIDE to assist me in my game's world development. To give a dynamic effect to map layers within tIDE, it has events that can be wired up to draw sprites before or after the draw of layers, to create foreground or background effects during runtime. This all works fine and well, however, the only way that I understand that this works, is by calling tIDE's internal spritebatch to create this effect. This creates a problem for me, because within tIDE's source code, its spritebatch's call block is set to SpriteSortMode.Deferred, and my characters have particle elements that I would like to draw in front of and behind themselves, via a drawdepth value.

I can use a separate instance of spritebatch and call my character's draw method, and set sprite sorting there, but then my character is drawn ontop of all layers in my tIDE map. Which is even worse to me than my particles not being drawn as I want them to be.

So, in summary, I want all of my crap to work, but at the moment the only way I can figure to do that is to ghetto rig the spritebatch within my characters' draw methods by calling a spritebatch.End();, then starting a new call to Begin() with SpriteSortMode.BackToFront, doing all of my characters' draw logic, and then calling another spritebatch.End(); followed once again by a new spritebatch.Begin().

Obviously that is pretty undesirable, but I don't know any other feasible alternatives. Anybody got any wisdom they could impart unto me as to how I could handle this?

share|improve this question
3  
Since tIDE is open source, and the problem you're describing happens because the internal SpriteBatch used by tIDE uses a different SpriteSortMode than what you need, you could download the source code for tIDE, make the change internally, and built it. –  David Gouveia Jun 21 '12 at 0:53
    
I'll try that. I'm just squeamish about meddling with tIDE's source, but truthfully anything I break can always be reverted, so I have no reason not to give it a shot! –  TheBroodian Jun 21 '12 at 13:31
    
Finding the source that I need to change is easy enough, but building it and retrieving the dll files required to reference the engine in my game has proven difficult... –  TheBroodian Jun 21 '12 at 14:44
    
Nevermind. Adjusted things as I needed them to be within the framework and figured out how to export the libraries properly, but setting the spritebatch to sort BackToFront within tIDE's framework breaks the rest of tIDE. :X So I still need something that will work inside of tIDE's standard setup. –  TheBroodian Jun 21 '12 at 18:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.