Line of sight behaviour question

For questions about using Classic.

Post » Tue Aug 07, 2012 5:40 pm

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 variableme11122012-08-13 14:22:22
B
8
S
2
G
2
Posts: 15
Reputation: 1,691

Post » Mon Aug 13, 2012 12:59 pm

Up
B
8
S
2
G
2
Posts: 15
Reputation: 1,691

Post » Mon Aug 13, 2012 4:33 pm

[QUOTE=me1112]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 ?[/quote]

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?

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

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.

[quote]
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[/QUOTE]

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?
B
6
Posts: 27
Reputation: 404

Post » Mon Aug 13, 2012 5:29 pm

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 !
B
8
S
2
G
2
Posts: 15
Reputation: 1,691

Post » Tue Aug 14, 2012 2:13 am

[QUOTE=me1112] 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.[/QUOTE]

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.Elyzius2012-08-14 02:15:12
B
6
Posts: 27
Reputation: 404

Post » Tue Aug 14, 2012 1:26 pm

Ok thanks, I think I will go your way !
B
8
S
2
G
2
Posts: 15
Reputation: 1,691

Post » Fri Nov 16, 2012 2:11 am

Krish
Hey! Did you know that you can hire me to make your games?

Click Here to See More
B
21
S
6
G
5
Posts: 391
Reputation: 5,627


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests