How do I make buildings transparent when walking behind them?

1 favourites
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • Hello, if anyone can help i would like to know how to make a building go see threw when i walk behind it.

    for my game its an open world and any buildings you go into you dont change layout or screen. when you walk into a building the outter skin of it (dike door,windows, outer color etc) disappears and you see the inside skin indead then everything outside turns black.

    i have gotten this part down. going inside

    but now with walking outside around the building again just want to be able to still see the player behind buildings cause they are skyscrapers and many of them and this is an RPG. if i didnt explain well just let me know and thank you. (:

  • Did you try when the building is overlapping the player change building opacity with trigger once?

  • Did you try when the building is overlapping the player change building opacity with trigger once?

    I don't recommend using "trigger once" here! It won't work correctly with multiple instances.

    Here is a very simple implementation:

    + System: Every tick
    -> Building: Set opacity to 100
    ----+ Player: Is overlapping Building
    -----> Building: Set opacity to 20
    
  • I didn't test it (not having time yet):

    Is it good for you with this?

    Instead of my tiled_wall_1, you will add instead the roof of your building to see through when inside.

  • > Did you try when the building is overlapping the player change building opacity with trigger once?

    I don't recommend using "trigger once" here! It won't work correctly with multiple instances.

    Here is a very simple implementation:

    > + System: Every tick
    -> Building: Set opacity to 100
    ----+ Player: Is overlapping Building
    -----> Building: Set opacity to 20
    

    Thank you this seems to work well. Though my building is going transparent correctly it is doing so when my player overlaps from the bottom of the building and I wish not to have that. I'd like the transparency to happen when the player is about a quarter or so up the buildings length so it looks the the building is grounded on the floor. Otherwise when it happens it looks like it is floating above the player.

    I was thinking about editing the buildings Collition Polygons but idk how to do that without messing up how the player moves when they're inside the building.

    The aim is the player can go I side building but not walk outside when touching walls/ceiling and when outside a quarter above were the building's grounded can walk behind it.

    But thank you, i got the transparency down 😊. And Sorry I know it's complicated.

  • Did you try when the building is overlapping the player change building opacity with trigger once?

    I have tried the overlapping thing to change the opacity but what will that do to make my player walk behind building? I would like my player to walk in front & behind but when behind the building goes transparent.

    Oh and is the Trigger in the Systems Action?

  • I didn't test it (not having time yet):

    Is it good for you with this?

    Instead of my tiled_wall_1, you will add instead the roof of your building to see through when inside.

    Thank you, but Do you mean when I walk Inside the building it will be transparent? That is not really what I need. I have it to were the frot picture of the building disappears/I visible when I go inside, that I don't need help on. It is when I'm outside the building and walk behind it I would like it to become see threw or transparent. Sorry if I did not understand you right.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh and is the Trigger in the Systems Action?

    Do not use Trigger Once when you have multiple buildings! This demo explains why:

    dropbox.com/s/xdsme1i8f817gf4/TransparentBuildings.c3p

  • > Oh and is the Trigger in the Systems Action?

    Do not use Trigger Once when you have multiple buildings! This demo explains why:

    https://www.dropbox.com/s/xdsme1i8f817gf4/TransparentBuildings.c3p?dl=0

    I see thank you. We're you able to see my other reply to you?

  • We're you able to see my other reply to you?

    Looks like I missed it.

    I'd like the transparency to happen when the player is about a quarter or so up the buildings length so it looks the the building is grounded on the floor.

    You can add additional conditions to the "Is overlapping" checks. For example, check that Player.BBoxBottom<=Building.BBoxBottom

    You can also pin an invisible sprite to each building with a slightly smaller collision mask than the building. And check for overlapping with that sprite.

  • > We're you able to see my other reply to you?

    Looks like I missed it.

    > I'd like the transparency to happen when the player is about a quarter or so up the buildings length so it looks the the building is grounded on the floor.

    You can add additional conditions to the "Is overlapping" checks. For example, check that Player.BBoxBottom<=Building.BBoxBottom

    You can also pin an invisible sprite to each building with a slightly smaller collision mask than the building. And check for overlapping with that sprite.

    What does the "Player.BBoxBottom<=Building.BBoxBottom" look like in code, or is it an instance variable?

  • Those are expressions. Every object in Construct has a bunch of expressions, I suggest checking them out, they are super useful.

    You can use "System Compare Two Values" condition for example. The first value being Player.BBoxBottom, and the second value Building.BBoxBottom

    Edit: actually in this case it's better to use "System Pick by evaluate" condition. First you pick all buildings which are overlapping the player, then pick buildings among them which have BBoxBottom>=Player.BBoxBottom

    ----+ Player: Is overlapping Building
    ----+ System Pick Building By evaluate (Building.BBoxBottom>=Player.BBoxBottom)
    -----> Building: Set opacity to 20
    
  • Hi. Sorry for the delay, my not Working Construct 3 notifications at their finest.

    Did you get your answer? If not, I will do something quickly with my screenshot from a few days ago with a shareable link with the feature you try to do.

    Maybe people here need more info about what you want, but I understood since the beginning what you want to do, don't worry ^^

  • Hi. Sorry for the delay, my not Working Construct 3 notifications at their finest.

    Did you get your answer? If not, I will do something quickly with my screenshot from a few days ago with a shareable link with the feature you try to do.

    Maybe people here need more info about what you want, but I understood since the beginning what you want to do, don't worry ^^

    Yes It did and thank you for your help. I'm not sure if everyone got it but one person has helped me with a code that works. Now I'm working on the Boolean for the door, I don't think I'm doing it right. When I walk to the door the outside skin disappears correctly but only while I'm overlapping the door. I need the door to act like a button were when I pass by the door the outer skin disappears and stays that way until I overlap the door again then it'll go back. Do you know how i can do this?

  • Hi. I have maybe the solution in my head. I'm very busy now, but tonight I will do a quick project to see how you can maybe do this. See you in at least 7 hours ^^

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