Draw the cone of view for Line of Sight Object

Get help using Construct 2

Post » Sun Sep 29, 2013 11:58 am

What I want is to have a cone (or triangle) will draw wherever the Line of Sight is facing, not just that but also change shape depending on if it's being blocked by a solid object or something.

Something similar to this:


So far I've used a graphic for the job, which works except when there is a wall that's only one tile wide:


I was thinking that it could be done with primitives, or going through the viewport position in a for loop and drawing a pixel if in line of sight, but neither appear to be included into Construct2 for some reason.

Any ideas?
B
24
S
5
G
1
Posts: 89
Reputation: 3,015

Post » Sun Sep 29, 2013 3:03 pm

I've tried making a 2D forloop, but doing a 2D for loop for over a million elements doesn't appear to be a good idea. :/

B
24
S
5
G
1
Posts: 89
Reputation: 3,015

Post » Sun Sep 29, 2013 3:10 pm

It's usually referred to as "shadow casting". There are a number of examples on the forums if you search.

Heres one. http://www.scirra.com/forum/capx-yet-another-shadow-caster_topic75045.html
B
43
S
23
G
20
Posts: 735
Reputation: 12,027

Post » Sun Sep 29, 2013 5:42 pm

[QUOTE=Ethan] It's usually referred to as "shadow casting". There are a number of examples on the forums if you search.

Heres one. http://www.scirra.com/forum/capx-yet-another-shadow-caster_topic75045.html[/QUOTE]

Thanks for the link, while it's good, I don't want to cast shadows, I just want to block out the light, I also want it to only to only show light from within the cone of view.

At least now I have a way of drawing primitives thanks to the Canvas Plugin now.
B
24
S
5
G
1
Posts: 89
Reputation: 3,015


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, David181, fens, Yahoo [Bot] and 11 guests