Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
How can I layer sprites like this? — Gideros Forum

How can I layer sprites like this?

keminekemine Member
edited December 2016 in Game & application design
i.imgur.com/V8izCGN.png

I have two sprites that are touching but not overlapping each other (A and B).

How can I place C so that it is above A but below B and
how can I place D so that it is above B but below A?

I'm GTweening objects into A but I want it to be covered by B, and I'm also GTweening objects into B but I want it to be covered by A. This would also be happening at the same time, so dynamically changing z-order wouldn't work.

How would this be possible, or if it's not possible how can I achieve this effect?

Comments

  • n1cken1cke Maintainer
    edited December 2016 Accepted Answer
    If your C|D objects are children of A|B and A|B are non-transparent rectangles without rotation then you can use Sprite:setClip(0, 0, A|B:getWidth(), A|B:getHeight()) on A|B so C|D will look like covered by A|B.
  • Ahhh thank you so much! I completely forgot about clipping!

    I was so set on getting z-order correct! Yup yup this works perfectly.
Sign In or Register to comment.