How do I make light follow a sprite in Phaser 3?

I want the light source to follow my sprite.

My code for light :

var light = this.lights.addLight(0, 0, 200);
this.lights.enable().setAmbientColor(0x555555);

In my update() I have :

light.x = sprite.x;
light.y = sprite.y;

Even though the code shows no error this approach does not work. Please provide solutions.

That is how to do it. What happens?

Nothing happens. The light just stays there. Nvm tho I created a function for the same and put it in update() and it works for some reason. Thanks :slight_smile: