Z Order - walking in front of & behind a wall

This forum is currently in read-only mode.
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • Hello everybody

    I'm new to this. I've done the Ghost Shooter tute and Platform school 1, 2 and 3, but not 4 & 5. They need 0.98.5. I have 0.98.3 and don't feel like mucking around with it yet. I don't know how to upload a cap file to these forums so have made a screenshot.

    I have made a demo of a person walking behind a wall. When they walk around it they collide with a hidden object that changes the z order of the wall. They then walk in front of the wall.

    When the person goes back again, they pass that trigger object and bump into another one that changes the z order back again which has the person behind the wall.

    It works but seems clunky to me. Is there a more elegant way of achieving having a person being able to walk behind and then in front of a wall?

    <img src="http://i405.photobucket.com/albums/pp136/beeble_bucket/Zorder.jpg">

  • might be able to trigger the z-order with the Y value of the player, relative to the wall.

    if Player.Y > wall.Y

    --put wall behind player

    else

    --put wall infront of player

    or something

    edit: if you use families for the code, you may need to have the Wall be first in the condition, so that it knows which wall to use. play around with it.

  • Yeah, use the Y co-ordinate. You really ought to upgrade to 0.98.5 too, there are some important bug fixes.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I suggest:

    put all objects to be sorted in a family

    Add event:

    For each object (ordered): family.y

    • send family to front (or back, I can't remember at the moment)

    Then it's all sorted automatically.

  • Thanks everybody

    I like the Y ordering idea. I will try it out. Downloading 0.98.5: done. I had already tried putting the walls in a family. But the rear wall needs to back in the z order and the near wall needs to be at the front if the person walks between them. So I can't treat them the same. However I will try dfyb's advice of putting the wall first in the condition.

    Thank you

  • Try using family.bottom instead of family.y. Does that work?

  • Arima

    Is this what you mean?

    <img src="http://i405.photobucket.com/albums/pp136/beeble_bucket/Scr_114.jpg">

    I'm just winging it with families. I don't really know what I'm doing. The family is called Blue. When I run the demo, it seems to reference the bottom point of the bottom member of the family. That is, the near wall. When I walk up to what should be in front of the rear wall nothing changes. I am behind the near wall and behind the rear wall too.

    Just in case anyone is in the mood to waste a few minutes, here's the link to my cap file.

    http://www.steekr.com/n/50-17/share/LNK825149755704efce7/

    Once the cursor is hovered over the file 'zOrderYpositions' a green arrow comes up in the top right hand corner. Left click on that and the option to download comes up.

  • Nope. This only requires one event.

    First of all, put every object you want sorted into the blue family, the man, player, walls, all of them. You might want to make a family specific for this - I made a family 'sort'.

    Second, make a new event, and double click system. Then select "for each (ordered)'. Then select the family blue from the object picker, and enter blue.bottom in the order expression text field. Leave it on ascending.

    Next up, click new action, and send blue to front.

    So it should read:

    For each Blue ordered by blue.bottom Ascending

    • Blue: send to front

    That's all there is to it!

  • Arima, you're a star. That worked perfectly. Thank you so much. My understanding of it is that the bottom of all objects in that family are automatically compared to each other to sort out the z order. That's a piece of art! Thank you.

  • Welcome, happy to help

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