How do I hide objects only behind a solid, not the solid itself?

0 favourites
  • 14 posts
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • Hi,

    I'm trying to make a horror game so what the player can and can't see is important. I've added a line of sight to my player character, and made it so if the player doesn't have line of sight to a wall or enemies, they are set to invisible. This works fine for all objects behind a given wall, but the given wall itself is ALSO hidden. I understand the logic that the wall being solid makes the player unable to "see" it, but I can't figure out a good workaround. Any suggestions for how to handle this?

    Tagged:

  • So you chose to set the wall to invisible, otherwise why is it invisible? If you have LOS of the wall it's visible? I don't understand the problem

  • It can be more helpful to post an image and maybe the part of the code that works with that mechanic so we can see how the logic is working.

  • Do you mean making the wall solid and not solid at certain times?

  • Check out this basic LoS code, there is an object behind the wall that the player cant see, using LoS to make the object visible or invisible accordingly.

    Note that all walls are visible, even ones the player shouldn't have LOS to (see the second wall behind the object)

    Now, applying the same idea to walls makes ALL walls invisible...

    I'd like only the first wall in a player's line of sight to be visible, and make all walls behind said wall invisible. I'm asking for how I would implement this.

    Also, I get that an object being a solid would block itself from being invisible, but I'm just wondering how to deal with that.

    Thanks for sticking with me so far

    Edit: fixing images...

  • Do you mean making the wall solid and not solid at certain times?

    Probably not since I'd want the walls to still stop enemies and the player even without LOS

  • I'm reading it and looking at the images and still don't understand what the problem is lol. But based on this : 'I'd like only the first wall in a player's line of sight to be visible, and make all walls behind said wall invisible. I'm asking for how I would implement this.', maybe pick nearest wall to player ?

  • I'm reading it and looking at the images and still don't understand what the problem is lol. But based on this : 'I'd like only the first wall in a player's line of sight to be visible, and make all walls behind said wall invisible. I'm asking for how I would implement this.', maybe pick nearest wall to player ?

    Pick nearest helps, but sometimes the nearest wall is behind the player and out of sight, thus setting the wrong wall to visible.

    Thanks for trying to help tho.

  • I mean pick nearest combined with the condition that player has LOS of it.

  • Hi again, I'm really interested in your issue.

    I tried this solution, but I apologize if it is not what you're looking for.

  • Hi again, I'm really interested in your issue.

    I tried this solution, but I apologize if it is not what you're looking for.

    This somewhat works, but again since solids hide themselves in their own los it tends to be buggy. Whenever the player moves, walls within los to the player begin flickering. A bit closer but still looking for a better implementation.

  • I mean pick nearest combined with the condition that player has LOS of it.

    Nah I've already tried this: probably should have mentioned that, sorry.

  • in my opinion you should add thin coat for each wall.

    Solid is invisible but coat are lighten up where are in sight or in light. I noticed it in Darkwood game

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Said coat is always covered by the solid it is created on, since it seems LOS attempts to "see" the origin, which is inside the solid.

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