How do I create perspective overlap

0 favourites
  • 5 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • 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

  • 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

  • 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

  • I think the Sprite.Y > Sprite.Y is the solution. Try removing the overlapping condition and just layer every sprite.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)