Line of sight behaviour question

This forum is currently in read-only mode.
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Well I have a few questions that I hoped could find answers here !

    I would like to make an ennemy come to my character but not too close, and fire some projectiles at him, but here is the thing:

    1: I set a line of sight for when they see me to come, and one when they are close enough, to stop, but isn't there any problem about when he reaches the shortest line of sight, he is still inside the large one, like, could I put priority to the short one ?

    2: Less important, isn't there any way of making the line of sight visible, to see more precisely the radius it affects ?

    3: Also nothing to do with the line of sight behaviour, but when I want to set the value of a global variable to a text, it won't accept, even though i've put the variable as a Text variable

  • Up

  • 1: I set a line of sight for when they see me to come, and one when they are close enough, to stop, but isn't there any problem about when he reaches the shortest line of sight, he is still inside the large one, like, could I put priority to the short one ?

    Sorry, but your question sounds confusing to me. Who has the line of sight to whom? What are the short LOS and the large LOS? Who is within these lines of sight, the enemy or the player?

    2: Less important, isn't there any way of making the line of sight visible, to see more precisely the radius it affects ?

    You could make your own graphics to show the LOS, but you'd also have to ensure that it matches with the LOS behavior. If you're looking for a built-in method for showing the LOS without having to make one yourself, I don't think there is any.

    3: Also nothing to do with the line of sight behaviour, but when I want to set the value of a global variable to a text, it won't accept, even though i've put the variable as a Text variable

    Assuming that the global variable is indeed a text variable and not a numeric one, you should be able to assign text to it using syntax similar to the one below:

        System: Set global variable 'StrGlobal' to "Hello world"

    How did you set the value of your global variable?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1 Well globaly the ennemy has two lines of sight, one to make them go forth, and a shorter one to make them stop. But what I wanted to know is if there might be any problem because the short one is inside the biggest one, so when an object enters the short one, somehow he still is inside the big one.

    2 Oh ok, thank you

    3 Well yeah I think I needed to put the " ", didn't knew that, thanks !

  • 1 Well globaly the ennemy has two lines of sight, one to make them go forth, and a shorter one to make them stop. But what I wanted to know is if there might be any problem because the short one is inside the biggest one, so when an object enters the short one, somehow he still is inside the big one.

    I see. You want the enemy to approach the player when the player is within the longer LOS but not within the shorter LOS. I've never tried to give an object more than one behavior of the same type until now. I tried it, and it worked, although it isn't how I'd have done it. I'd have assigned only one LOS behavior to the enemy and checked for the distance between it and the player instead. Construct has a built-in expression for checking distances between two points.

    Off hand, the only problem I can think of with having two Lines of Sight for the same object is that it is computationally wasteful. Having only one LOS and checking for the distance between the enemy and the player uses up less computing power. Other than that, as long as you set up your events properly, you'll be able to get them to work as intended.

  • Ok thanks, I think I will go your way !

  • Would this help:

    Tutorials - enemy-ai-for-range-of-fire-and-line-of-sight-top-down-player

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