57 light - JcerelusDev/CanvasGameJs GitHub Wiki

What is light ?

As its name described it clearly, light is a method that can be use to create a fake light in your 2d world.

How does it work ?

light takes 3 arguments :

1.- the object to apply the light

2.- the radius of the circle based light.

3.- opacity (which you can play with to find the suitable one)

Example :
   const game = new Stage()
     -------------------
     -------------------
    
   const player = new Sprite(100,200,16,16,0,0,"red")

   game.update = function(){
     game.light(player,80,0.4)
   }
    
   game.render = function(){
    player.drawSprite()
   }