How do I Flashlight view

Get help using Construct 2

Post » Sun Mar 23, 2014 11:52 am

Hi everyone!
I wanna create a flashlight view similar to "fog war", something like:

- an object "shadows" in the layer's top whitch is black with 60% opacity (aprox)
- enemies out the flashlight view are hiden
- scenary is allways visible but when the flashlight is off is all in shadows, (because the top object "shadows"), but when you focus your flashlight the shadows disappears in the cone of view and you can see the true colors of the objects and background and the enemies become visible.

I can't find any tutorial about this lighting effect, so please if you know about one, link it to me, or if you did something similar please advice me about how to do it.

thanks for your time

regards!!
B
21
S
3
Posts: 77
Reputation: 1,112

Post » Sun Mar 23, 2014 12:57 pm

Here's one I made a while ago, but if you adjust the shape of the Torch to suit the shape you want, it should work well.

Main things is you need to have 2 layers, 1 which is the FOW and the other which is below it. The FOW layer must force its own textures (Under layer properties). Also you need to set the fade to a fairly low time, or it will just remain on screen, and to use the blend mode Destination Out.

https://dl.dropboxusercontent.com/u/108 ... s/FOW.capx
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Sun Mar 23, 2014 1:32 pm

here is a slightly adapted capx from https://www.scirra.com/tutorials/793/the-land-of-light-and-shadows-part-2 (sad self promotion :) )
You do not have the required permissions to view the files attached to this post.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Sun Mar 23, 2014 6:54 pm

Thanks, i'm going to response in this thread the results of my work
B
21
S
3
Posts: 77
Reputation: 1,112

Post » Tue Mar 25, 2014 6:24 pm

Hello everybody, I come back with more questions!
Thanks to your help I could do something similar to a Flashlight view, but between some bugs that need to be fixed I have one for what I need your help.
Do you see the superior wall call "muro_exterior"? the function "fisica linterna" can't calculate the distance between the flashlight and it.
I think that it is because this sprite is an instace with modificated proportions of the original object, but I'm not sure of that.

Any idea?

Thanks!

src: h t t p s ://mega.co.nz/#!JtQH1IZI!MOSpHb6kCThOf4k4JzArUXIg2MbA9-XxSefZam67Pek
B
21
S
3
Posts: 77
Reputation: 1,112

Post » Fri Mar 28, 2014 10:15 am

you are saying

if the flash light is touching the wall set the length of the flash light to the distance from the (location of) flash light to the (location of) wall

but

the wall is very long and its (the wall) location is not where the flash light is touching ie the wall might be 400 pixels long and 30 pixels high with its location (centre) at 200 pixels from it left hand side - so if the flash light touches the left hand side of the wall then its length will be set to 200 plus pixels . Does that make sense ?

One way around this would be to use much shorter lengths of wall to make your exterior wall.

Thanks for doing the tutorial translation.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812


Return to How do I....?

Who is online

Users browsing this forum: varr and 4 guests