How do I create perspective overlap

Get help using Construct 2

Post » Sun May 31, 2015 8:14 pm

Hi,

I have multiple instances of the same object and im trying to get the ones with the higher Y position, to display above the ones with a lower Y position.

what i have is this,

Sprite is overlapping Sprite
if Sprite > Sprite.Y

Move Sprite to top of layer

This doesent seem to have any effect. Was wondering if anyone could help.

Thanks
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Mon Jun 01, 2015 12:35 am

It should read:

Sprite is overlapping Sprite
if Sprite.Y > Sprite.Y

If that doesn't work, try creating a family and put the sprit in it. Then write it like so:


Sprite is overlapping Family_Sprite
if Sprite.Y > Family_Sprite.Y
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,273

Post » Fri Jun 05, 2015 1:09 pm

Sorry to resurrect this, but i'm still faced with this problem.

I'm using the free version so i'm unable to try it with families. However, i have tried lots of different ways of doing this, but still cant get them to overlap correctly.

Just to make it super clear, what im trying to do is set my sprites so that they are displayed above an instance of the same sprite (and others), when they are closer to the bottom of the screen (Higher Y value). Also, when they move back above the sprite, to then be displayed behind.

I would list everything i have tried, but aint nobody got time for that, and to be honest i cant even remember.

If someone could give this a crack it would make my day. been at it for ages.

Thanks
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Fri Jun 05, 2015 9:54 pm

I think the Sprite.Y > Sprite.Y is the solution. Try removing the overlapping condition and just layer every sprite.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,414
Reputation: 4,822

Post » Fri Jun 05, 2015 10:04 pm

I'm doing pretty well with Sprite.Y >Sprite.Y, though I don't worry about sprites overlapping other instances of themselves, so I don't have the picking problem.

One fairly computationally expensive method is to sort everything on the layer by Y. I do this for about 8000 trees at the start of every layout, and it's not too bad, but every frame could be rought. You could For Each over every sprite in order of Y and Send to Back/Front of Layer, but @RexRainbow has a plugin that does this, and I think it's faster: http://c2rexplugins.weebly.com/rex_zsorter.html
B
14
S
5
G
1
Posts: 189
Reputation: 1,536


Return to How do I....?

Who is online

Users browsing this forum: Sparkz and 3 guests