I am a beginner trying to create a real-time art for an assignment in processing with true or false conditions and a mouse press.

So far I have been able to play around and gain understanding with some code I found on the processing website to look and function the way I would like, but every time I add new code from tutorials and the processing website for colour changes or mouse pressed, I am getting errors of active and static and other code errors that I don’t understand.

What else I would like in the code:

Background random colour change with mouse press

Star collision changes when the stars hit each other.

Here is my code; any help with some explanation would be appreciated and some points in the right direction would be appreciated.

A program written as a list of statements (like the previous examples) is called a static sketch. In a static sketch, a series of functions are used to perform tasks or create a single image without any animation or interaction. Interactive programs are drawn as a series of frames, which you can create by adding functions titled setup() and draw() as shown in the code below.

So, you can do certain things with no setup and no draw. But you want animation, so you need exactly one draw and (optionally) one setup, and the commands should go inside them. You can’t have more than one setup or draw.