Sprite Z Priority

Discussion in 'Questions (Windows Mobile)' started by fjsantos, Jul 18, 2008.

  1. fjsantos

    fjsantos Member Licensed User

    Hi all!

    I am currently using sprites for my app. But i need to know which sprites goes under which one.
    For that I need to assign any 'z priority' to sprites. I read reference and i not found anything about that.
    Is There any way to change 'z priority' of sprites?

    Thanks in advance.

    Best regards, fjsantos.
    ________
    buy vaporizers
     
    Last edited: Jan 24, 2011
  2. Erel

    Erel Administrator Staff Member Licensed User

    Sprites are drawn to the screen in the same order they were added.
    So the last sprite added will be the front-most sprite.
     
  3. fjsantos

    fjsantos Member Licensed User

    Yep, I know that, but i need to have a sprite in front of the rest of sprites.
    I add this sprite last, but when i create and recreate more sprites dinamically, the order obviously, change.

    One solution, of course is destroy that front sprite, create sprites i need and recreate that front sprite, but that solution is time consuming and a bit boring.

    There is another way to change that priority?

    Best Regards, fjsantos.
    ________
    Yamaha GT80
     
    Last edited: Jan 24, 2011
  4. Erel

    Erel Administrator Staff Member Licensed User

    There is no need to really destroy and create a new sprite.
    Try something like: (I haven't tested it)
    Code:
    sprite.MarkedForDelete = true
    gw.DeleteMarkedSprites
    sprite.MarkedForDelete = 
    false
    gw.SpriteAdd(sprite.Value)
    sprite.IsActive = 
    true
     
  5. fjsantos

    fjsantos Member Licensed User

    Thanks Erel, that works like a charm!!

    Best Regards, fjsantos.
    ________
    how to roll a joint
     
    Last edited: Jan 24, 2011
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice