Hello again, my question is how can i make something like that but in canvas:
i just want to fill a rect in the whole screen and i wan to see the level through a hole;
well thats the idea, thanks in advance, friends…
Hello again, my question is how can i make something like that but in canvas:
i just want to fill a rect in the whole screen and i wan to see the level through a hole;
well thats the idea, thanks in advance, friends…
Create an image of a black rectangle with a transparent hole in the middle. Overlay that image on top of your scene. Google " game development image masks" for more info.
A variety of ways. If you have multiple light sources you could simply save the “darkness” in a buffer, loop through the lights updating/clearing out the buffer and at the end draw the “light-filtered” buffer on top of the scene.
A lot of drawing API’s come with some sort of masking built in though so you may as well use them if available.
In vanilla html5 it could look something like this: http://codepen.io/hannyajin/pen/OybdPP
thankyou i’ll check it all