How do I FLIP LINE OF SIGHT

Get help using Construct 2

Post » Mon Mar 17, 2014 12:44 pm

i have a rather simple question that has been bugging me from day one but i had postponed it until today.
lets say we have a square that is moving right.
LOS is starting from the origin point?
if yes, does the cone of view always face to the right? (in 180 degrees)
and if yes ,if i mirror the box will it face left?
can i assign a specific imagepoint to los?

from the manual:
Cone of view
The angle of the cone of view in which the object can have line-of-sight to other objects, relative to the current angle of the object. For example if this is 180, then the object can have line-of-sight to any objects anywhere in front of it, but never behind it. If 360, the object can have line-of-sight to objects at any angle.

could someone please help (including me) to add more info to the manual that is severely lacking in small but important things that could help us speed up the process of creating games?
@tom @ ashley
could you implement a way for us users to add info to the manual (wikipedia style) ,and after you guys review it as correct information then publish it? this way the manual will expand at a rapid pace with useful little info and it will take the load off the forums .
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Mon Mar 17, 2014 5:17 pm

if i remember correctly the LOS cone will change if you change the angle of the sprite... so if you mirror the sprite the cone of view will mirror too... another fix is to have 2 sprites... the actual sprite of the enemy... ans another one...a small one make it invisible and pin it to the enemy sprite... and have the LOS behaviour on the little sprite... so you can rotate the angle of the sprite and therefore the line of sight cone wihtout affecting the enemy sprite :)
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Mon Mar 17, 2014 5:57 pm

@Lunatrap
thank you for you reply but i have a few questions still unanswered and maybe someone could join the conversation and help.
since it changes angle (los) according to the objects angle it makes perfect sense for a top down shooter like the example in c2.
but if you have platform behavior in your square where is the los pointing at (180) during first utilization ?
up,down,left or right?
your idea of 2 or even three squares rotating depending on where my other square is going (left or right) so i can have front and rear 180 detection will work (although i believe that there should be a better engine implementation) but if i do not know where it is pointing how can i know how many degrees to rotate for left and right my extra (lol) dummy squares?
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Mon Mar 17, 2014 6:06 pm

Roccinio wrote:@Lunatrap
thank you for you reply but i have a few questions still unanswered and maybe someone could join the conversation and help.
since it changes angle (los) according to the objects angle it makes perfect sense for a top down shooter like the example in c2.
but if you have platform behavior in your square where is the los pointing at (180) during first utilization ?
up,down,left or right?
your idea of 2 or even three squares rotating depending on where my other square is going (left or right) so i can have front and rear 180 detection will work (although i believe that there should be a better engine implementation) but if i do not know where it is pointing how can i know how many degrees to rotate for left and right my extra (lol) dummy squares?


i used LOS on platform games... i only make parform games... so everything i tell you i have tested it in a platform eviorement

the LOS angle will be the same as the sprite wich has it... let me make you a .capx ill be back :P
Last edited by Lunatrap on Mon Mar 17, 2014 6:31 pm, edited 1 time in total.
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Mon Mar 17, 2014 6:28 pm

here!! see if that wworks for you!!!

if none of the enemies are looking at you you will be red
if any of them are looking at you you will be green...
take oin considerection that the distance is 300px wich means that if you go to the righ side... none of the 2 will see you ebcuase you are more than 300px far so they dont see you... the cone of view is 90 for both... you can change it :)

test it and tell me if you find anything worng :D
You do not have the required permissions to view the files attached to this post.
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Mon Mar 17, 2014 7:48 pm

@Lunatrap
thank you!
after dismantling your brain child (i hope you don't mind!) i figured out for future reference that by default it faces right (o degrees ) from the origin point.so if i want to have left and right detection i should add another square on top of the first one and make its angle 180.
if you are a boy i owe you a beer if you are a girl a glass of wine and some flowers!
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Mon Mar 17, 2014 8:27 pm

Roccinio wrote:@Lunatrap
thank you!
after dismantling your brain child (i hope you don't mind!) i figured out for future reference that by default it faces right (o degrees ) from the origin point.so if i want to have left and right detection i should add another square on top of the first one and make its angle 180.
if you are a boy i owe you a beer if you are a girl a glass of wine and some flowers!


im a girl, and thanks :)
you dont have to put 2 squares... with one is enouhg... look ill be back :)
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Mon Mar 17, 2014 8:42 pm

Roccinio wrote:@Lunatrap
thank you!
after dismantling your brain child (i hope you don't mind!) i figured out for future reference that by default it faces right (o degrees ) from the origin point.so if i want to have left and right detection i should add another square on top of the first one and make its angle 180.
if you are a boy i owe you a beer if you are a girl a glass of wine and some flowers!



here :P CHECK IT OUT n.n
now the 2 enemies have 2 "cameras" or "eyes" if you will
and you can change the angle in any direction and the LOS will change aswell (angle of the sprite = angle of the LOS cone of view) if you want the cone of view to be 180 just adjust it in the properties :)
btw sorry if my english is not good im not from a country that speaks english :)
You do not have the required permissions to view the files attached to this post.
B
23
S
6
G
3
Posts: 316
Reputation: 3,461


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, guannstar, marcinkowski, Shenkai the ssj, Yahoo [Bot] and 12 guests