Hi, I want to make a game. I already have, but collision was only with rectangles. I was wondering, how would I go about making collision for environments like this?

How to make custom collision shapes-exmple.png

Would the collision(Red) Be like this?

How to make custom collision shapes-exmple1.png

Because I want to make a custom shape combining it all into this.

How to make custom collision shapes-exmple2.png

And check collision to make the character not run into it and through it. HOW?