I'm having a bit of trouble finding a solution to my problem.
My game involves a timer set for 30 seconds. When the timer is up, the lights go out. When the lights go out, you can see only yourself inside of a little glowing bubble as seen here.
This is the character when the lights are on.
I recently ran into a problem while making a second, bigger bubble around the candle rather than the player. Currently, I make the little bubble by drawing an image in the middle of 4 black rectangles. Now, this won't work because the two different images would overlap creating a strange looking display.
I was thinking I could clear a circular area out of a different canvas with a black background (one that is not visible) and copy that image over to the original canvas. I tried that and it was very slow.
Does anyone know an efficient way to solve this?
Thank You!
PS: If you want to see the code that I use now, here it is
ctx.fillStyle = "black";
ctx.fillRect(0, 0, cvs.width, cvs.height / 2 - 124);
ctx.fillRect(0, 0, cvs.width / 2 - 125, cvs.height);
ctx.fillRect(0, cvs.height / 2 + 125, cvs.width, cvs.height / 2 - 125);
ctx.fillRect(cvs.width / 2 + 125, 0, cvs.width / 2 - 125, cvs.height);
ctx.drawImage(img.glow, cvs.width / 2 - 125, cvs.height / 2 - 125);