PImage and Image switch

I want to create an atmosphere to generate an structure by switching colors, I wanted those layers to come in order and make that structure. However, when I press every key I designed In the keyPressed event for each layer, the previous layer vanishes. also, I wanted to draw them with a right-click but Not only cant I draw them by clicking but also layers vanished by the previous one I know the main problem goes back to drawing but I don’t know what should I do. May I kindly ask you to help me?

My work

Hi and welcome

Have you try something ??? Show us what you tried if you did

Dear I sent my Google drive link.actualy I can put it here