So, the program had this bug where every interaction rewrite the screen, and rewriting the screen it actually load the same image instead of reusing the old ones. In this way every input the ram was loaded more and more occupying gigabytes of ram and crashing the system.
I worked on this error and at the end I made some edits on the code, now the actors don't share anymore the same layer and instead every actor have a specific layer. I still have to redo the mouse selection, I leave in the code commented the previous source and is not a lot of work but probably I will code the section again from scratch, now that I have more method to pick the actor position based on layer measure.
The mouse is not a big deal, but I wanted to commit a more usable code now that it works.