Flashlight effect

Get help using Construct 2

Post » Thu Mar 01, 2012 7:06 pm

What is the best way to simulate a flashlight effect?

Example: Here

Currently, in the example, I am using a large sprite with a transparent image with a hole in it. This sprite follows the mouse. For it to work correctly, the sprite needs to be much larger than the image behind it.

Should I create a small sprite/image, and change the size after dropping it on the layer (or runtime).

Is there a way different way I can do this?

FYI: The example above was the very early beginning of a POC for a game we were working on.

Thanks!
B
31
S
10
G
7
Posts: 30
Reputation: 5,408

Post » Thu Mar 01, 2012 8:38 pm

There's another way you can achieve lighting.. this way doesn't require huge sprites and you can have multiple lights too:

If you create a layer above your current and name it "lighting"
Have these settings:
background colour > black
Transparent > no
Opacity > 100
Force own texture > Yes (not entirely sure what this does, but it doesn't work without it)
Visible in editor > no (otherwise you can't see sh*t :) )

And then the actual 'light' object needs to have the effect called "Destination out" (in the object properties) and also needs to be on the "lighting" layer.

The 'light' objects image itself needs to be just be white with transparency (can be a bit awkward in some image editors)

The more transparent it is, the less it 'erases' the darkness if that makes any sense.

Here's an example of a light i'm using:
http://dl.dropbox.com/u/53374990/512W.png

Try highlighting it or copy it into an image editor if you can't see it.keepee2012-03-01 20:39:36
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Thu Mar 01, 2012 8:47 pm

Have a look at the 'lighting' example included with C2.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Thu Mar 01, 2012 9:00 pm

Oh gawd, I can't believe I typed all that when there's an example -___-

i forgot :)
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Fri Mar 02, 2012 3:19 pm

And I can't believe I didn't look to the examples before posting. Thanks for the info, and thanks for the effort. Much appreciated!!
Ugh. I knew I had seen it before.
B
31
S
10
G
7
Posts: 30
Reputation: 5,408

Post » Mon Aug 26, 2013 9:02 am

But how o how do i mak a light which does not pass through walls (top down walls)
B
20
S
8
G
2
Posts: 122
Reputation: 3,202

Post » Tue Sep 17, 2013 6:46 am

@ash1221 - What do you mean, exactly? What's going on?
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

Post » Tue Sep 17, 2013 12:41 pm

@Rhindon , this is what i mean
http://www.scirra.com/forum/topic75822.html
B
20
S
8
G
2
Posts: 122
Reputation: 3,202


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests