Often times in your game, you might want to have your player in a dark place and add a lighting effect either to the player themselves or to torches on the wall or other objects to give the feeling of being in a dark place and provide the player with some light to see. In this quick tutorial, I will show you how to create a lighting effect in Construct 2, and this should also be able to be applied to Construct 3.
First, you will want a large, fading white (or color of your choice) color image. Have the color strongest in the middle and fading out as you get towards the edge of the image. You can download a white color image here.
In your game file, create a layer at the very top of your layers. In this instance, I will call the layer "Light." but feel free to name it whatever suits you.
Then, in your layer properties on the left hand side, you want to change the background color to black and set the transparency to no.
Next, bring in your light .png file either by dragging it in or creating a new sprite and selecting your light file.
Once you have the light imported into your game, go back and click on the light layer, select the effects link and you can start to type multiply. You want the multiply effect. Add that effect and close out of the window.
Now you will see that you can see part of the game where the light image is.
Here you will want to click and drag the light either to the player or to the sprite you want the light effect to be on. In this case, I am placing the light on the player in this game.
Because I am adding this to the player and I only want the lighting effect to happen when in the cave part of the game, I don’t want the light effect to be global, so go to the event sheet for that specific level.
Create a new event and select system —> every tick
Then add a new action and select the light object —> set position to another object
In this case, I will be selecting the player. If you are using an object such as a torch, you will want to select the torch or whatever object is going to be providing the source of light.
You’ll notice that the white immediately around the area is a solid white. To correct this, select the light object and then change the opacity to 50
When you run the game, you will see that there is a light surrounding the player and it will follow the player as they move throughout the level. Or if you have attached it to an object, the light will be on the object and project slightly out from that object.
This lighting effect allows you to give more of a feel of the player being in a dark place, but allowing them to see for a certain distance around the player or around the objects when spaced at certain distances. You can play around with the size of the light image and with different opacities to give the desired effects for your game.
Since we added this to an event sheet that was only specifically for this level, when the player leaves the level and goes on to the next, the light will no longer be following them unless you have done the same for the next level or you have made this as a constant throughout your game.