XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Layering between Spritebatches

Last post 2/21/2009 8:26 PM by FortisVenaliter Productions. 3 replies.
  • 2/21/2009 6:08 PM

    Layering between Spritebatches

    I am making a point and click style game , but it is quite large , i was wondering if there is any way to layer between different spritebatches , i know this may not be advisable , but currently i see this as a good solution !

    I have one spritebatch running which draws most of my background textures and such, however i want the highlighting of areas , or changing of some sprites , to be internal to the scenes  , for which i need a new spritebatch in the scene , the problem is that i want the images drawn with this spritebatch (in the draw function of the currently active scene), to lie above the ones drawn with the one that is drawing all my backgrounds. Is there any way to instruct XNA to do this , except trying to change the order of execution?

    I will be very greatful for any help that you may be able to provide in this matter
    Thanks In advance
    Nik
  • 2/21/2009 6:24 PM In reply to

    Re: Layering between Spritebatches

    Well you could pass the same spritebatch and pass the optional layerDepth variable. Make sure you use SpriteSortMode.FrontToBack or BackToFront
    Regards,
    Louis Ingenthron
    Fortis Venaliter
    Lead Developer of FV ProductionsFV Productions
  • 2/21/2009 7:28 PM In reply to

    Re: Layering between Spritebatches

    Can the same thing be done if the SpriteBatch is added to a service and used from there ? Because i tried to do this and it didnt work , i set all the parameters properly too, so i just assumed that maybe because i got the spritebatch from a service , it is not allowing me to continue with the layering scheme!
  • 2/21/2009 8:26 PM In reply to

    Re: Layering between Spritebatches

    Not sure. I don't use services. However, I usually use a single static Spritebatch, because I don't know of any reason to use more than one.
    Regards,
    Louis Ingenthron
    Fortis Venaliter
    Lead Developer of FV ProductionsFV Productions
Page 1 of 1 (4 items) Previous Next