How to make a "light" follow a character in a dark level? (Uncategorized artifact)

I’m a teacher and one of my students wants to make a top-down game where the main character is in a cave and the cave will be dark, but the character is holding a torch and when they move an illuminated radius follows the character.

Hi @MrVargas,
I suggest adding darkness to the objects that are farther away from the player by using the colors behavior.

I have an example that shows how to do this:
https://flowlab.io/game/play/1505963

3 Likes

@MrVargas - Another approach that isn’t nearly as flexible & nice, but probably simpler to implement is to cover the screen with a large “darkness” object that has a hole in it representing the “light”. Just scale the darkness object up and position it over the player, like this:

1 Like

You could add a sprite (a very big one) that has a hole in the center of it, and attach it to the player.

Mr. Grazer I making a top down game with darkness effect. I saw the example you sent and it work out well. Next level I added a camera behavior and the darkness effect isn’t following the player anymore. Can you help me?

Please don’t revive old topics create your own. But did you spawn the light object in the UI layer?

1 Like

Not yet. I’m kind of new to flowlab.

Yup that’s your issue then lol

I mean not spawning in your light object

Im just gonna ask my friends.

1 Like

Wha- ok that’s fine…