Line of Sight behavior/condition not triggering action

0 favourites
  • 10 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Find the project file here. This question regards the "InGame" layer and event sheet.

    I am attempting to use the player sprite's Line of Sight behavior to trigger an action. In this case, just for testing, it should make the text "Snake detected!" appear on the screen:

    However, this action is not triggering. This is a snapshot of the behavior's settings:

    And here is a snapshot of the relevant event on the event sheet:

    I have attempted the following to see if anything would help, but nothing has worked:

    • Making sure the origin point of the snake sprite is in the middle for all of its animation frames.
    • Making sure the snake and the player are on the same layer within the layout.
    • Switching between "solids" and "custom" within the Line of Sight settings, just in case that made a difference.

    No matter what settings I change, the action does not trigger.

    I would appreciate any help on this matter!

    Tagged:

  • Possibly a bug that is getting fixed next beta releast. github.com/Scirra/Construct-3-bugs/issues/6435

  • Try increasing the range? Why is it 20 pixels?

  • The action is not triggered regardless of how big the range is. For example, 2,000 and 20,000 also don't work.

  • It's because the text is not in the position you think it is, you've put it on the UI paralax layer so it is always off screen, move it to the Game layer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's because the text is not in the position you think it is, you've put it on the UI paralax layer so it is always off screen, move it to the Game layer.

    I'm afraid moving it to the InGame layer is also not fixing the issue.

  • Move it to the ingame layer and increase the range, 20 is too low and doesn't stretch past the player object. Make it something more reasonable in front of the player to detect the snake.

  • Move it to the ingame layer and increase the range, 20 is too low and doesn't stretch past the player object. Make it something more reasonable in front of the player to detect the snake.

    That seems to have done it! I must admit I don't quite understand why being on the UI layer renders the text action invisible but not the arrow key buttons, but I can look into that.

    Thank you very much for your help!

    And thanks to you as well, oosyrag, for your contribution earlier.

  • To correct myself: I think I understand.

    The arrow keys are placed onscreen initially, and I've set the UI layer to not scroll away. This was to keep the arrow keys visible at the same place no matter where in the game you are.

    With the "Snake detected!" message also being on that layer and having its initial placement too far offscreen to see, you can't walk over to it to see; just like the arrow keys, it always retains its position relative to the viewport since I've turned off paralax. So in essence, it was working as intended, but I didn't realize that the layer was forcing it to always stay out of range of the viewport.

    Many thanks, lionz! I don't know if I would have figured this out on my own!

  • Yes exactly that except you had two bugs at the same time because the tiny range was not working on the snake anyway. If in doubt check in debug preview, you can select the actual objects and check their position, you will see the text object on the UI layer and static off screen.

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