How to create a circle of light around player.

Is light sources restricted to executable type games only? On a HTML game I would like there to be a circle of light (only part of the screen the player can see) around a player for say 150 pixels, or, just from the direction the player is facing (I could add it to an object following the player). I cant see a light behaviour. Is it possible?

Hi there. Im kinda new in the forums and in GDevelop as well but looking for tutorials I came across this post and seconds later I found this:

Hope this helps! Good luck!

This is not directly possible in HTML 5 that I know of. If the link above works with HTML 5, then awesome. :smiley:

You can check a simple option here:

It will provide you up to one light effect by basically making a big shadow that is all around the player and follows the player, with a “cut out part” in the shadow which simulates the light. The other options discussed below are a bit more difficult to use.

So, if you wish to have only one light, then you can do it this way, although it’s not perfect. For multiple lights, it’s up to more complex.

If you simply want a shadow and not to make the entire screen “dark”, you can check my little shadow tutorial:

In the end I managed to get the effect by creating a black screen large enough to cover the whole screen and fade out a section using a photoshop program. Then I centered it on the player. Still worked :smiley:

Oh, I also need this. I plan to create horror game with collage theme. Where you are trap in the first scene the library.