I put an object an opacity 0 and sometimes the player sees it

0 favourites
  • 6 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hello, I gave the behavior line of sight to my player to not see through the walls the enemies, for the enemies it works very well, I see them that when it is in my line of sight, the problem I have that I created a heart-shaped bonus, a heart represents a life, the bonus object sometimes I see it through the walls sometimes they are invisible, I do not understand why sometimes I see hearts through the walls while the enemies remain invisible??? I put you the code,

    + System: Each tick

    -> Enemies: Set opacity to 0

    -> life: Set opacity to 0

    -> Score: Define the text to "Score" & Score

    -> Life: Define the text to "Life" & player.ViePlayer

    + player: A LineOFMire on Enemies

    -> Enemies: Set opacity to 100

    -> life: Set opacity to 100

    -> player: Add the wall obstacle to LineOfSight

    if you ever need more details I put a link to the game, thank you in advance for your help.

    dropbox.com/s/jwzrzb3iddpz3s6/FunShooter%20%282%29.c3p

  • You have enemies that are off-screen, you don't see them but your character has LoS to them.

    Run the game in Debug Mode, when this bug happens, pause the game and check all enemy instances one by one.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello, I don't see the problem with enemies? If I don't see them it's because I added the walls as an obstacle, is there a problem? For me the problem is that I see the hearts, while there is a wall between us, I will look at a debug overview, thanks for the advice.

  • Hello, I don't see the problem with enemies? If I don't see them it's because I added the walls as an obstacle, is there a problem? For me the problem is that I see the hearts, while there is a wall between us, I will look at a debug overview, thanks for the advice.

    In a lot of your posts recently, the issues you've experienced have come down to you not understanding Conditions and Actions

    Your code is like this:

    +Player has line of sight to enemies (Condition)

    ->Set Opacity of Enemy to 100 (Action)

    ->Set Opacity of Heart to 100 (Action)

    This means, whenever the player has LOS to an enemy, that specific enemy will be set to 100 opacity. But then you're also making it so EVERY heart will be set to opacity of 100 too. This is because both actions are under the "Player has line of sight to enemies" condition. If you only want the hearts to appear 100% Opacity when the player has LOS to them, you need a separate condition

    +Player has line of sight to Heart

    ->Set Opacity of Heart to 100

  • If you're going to have lots of objects that disappear when not in LOS, you can create a Family called LOSFamily and put all the objects you want to disappear in it

    Then, you only need 1 event

    +Player has LOS to LOSFamily

    ->Set LOSFamily Opacity to 100

  • Okay, thank you very much, I didn't think to separate the conditions, thank you for pointing that out to me.

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