How to make a flashlight effect?

0 favourites
  • 5 posts
From the Asset Store
A total of 214 high quality and unique magic sound effects suitable for RPG, Battle Arena and more!
  • Im looking for ways to make say a flashlight kind of effect and im wondering if anyone can point me how to do it? I tried doing it with a dynamic lightning but i cant seem to get it to work.. Any suggestions or examples would be very helpful

  • Hey,

    I've done a bit of tinkering around with this problem too. Here's one way to do it (though there are probably more, way prettier ways to do it. for example check out madsters "Dark Asteroids" game):

    Take a look at this cap. Arrow keys move, mouse points flashlight.

    Basically for my solution you need at least two layers. The top one needs to have the Multiply effect on it. Then create a white gradient in some sort of graphics program like the GIMP in the shape that you want your flashlight to have. In the cap, I've made the gradient larger around the player so you can see what you're doing. The layer beneath the top one should have your game elements like your player, etc.

    You can stop there, but in the cap, you'll see that i've added a light object and some shadow caster objects. Take careful note how the layers are set up and what is in them.

    Hope this helps.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Aside from the suggestions in this forum, you also have to research for the proper procedure. Flashlight effect is one of the good things to be done. You should be knowledgeable in doing this.

  • Add a new layer, untick 'transparent' in the layer properties - make a white spot light sprite, then make that layer use 'multiply'. Instead of a sprite, if you want shadows, you can use the light object and add shadow caster behaviours to the objects that need to cast shadows.

  • Hey,

    sorry to dig up this old thread, but I found it via the search and thers that may find this too should maybe know this:

    To make this work with tiled backgrounds, you have to use a block-element (no sprite) with shadow-caster behaviour and properties "solid", and the sprite or tiled background on top of that (work with layers here, because you aren't allowed to make the shadow-caster block just beneath the tiled-background on the same layer - it leads to strange results). Making the shadow-caster block invisible at runtime via events also don't work, the shadow-caster element will need to be visible (although beneath another sprite/tiled background) to cast a shadow.

    I used different blocks with standardized heights (50 for walls, 10 for high objects, 1-2 for obstacles like crates etc).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)