Is it possible to dim the entire screen in Processing?

So I’m trying to make a 2D Platformer game that goes like this:

A boy (the player) is trying to get home from the starting point before dawn, and he has a companion of a little flame sprite to keep his surrounding illuminated.

So the idea is that the little flame sprite burns out in, say, 10 seconds. And during that time, the boy has to collect another flame sprite (similar to collecting coins in any other platformer game). If he doesn’t, the screen gets dimmer and dimmer until it blacks out completely, and game over.

This game idea is submitted to my teacher before I had any understanding of Processing, and back then I thought, “well, Processing has lots of functions, there probably is a dim screen function somewhere. I just don’t have the knowledge on where to look at yet.”

So tldr; Is there a dim screen function? Or anything that can help me gradually dim my game screen until it blacks out completely?

Thanks in advance!

You can use an overlapping PGraphics, changing gradually it’s transparency with tint().

1 Like

Hello,

Draw a rect() to fill the canvas and overlay what you already have.
Use fill() and transition the alpha from fully transparent to fully opaque.

There are references, examples and tutorials here:
Processing.org

:)

1 Like