Quote Originally Posted by Jenner View Post
What you ultimately want is what's called a Quaternion.
One of the reasons they're used in rotation is they don't suffer from gimbal lock which is a major plus.
You don't need quaternions for 2D, there's no such thing as gimbal lock there.

For the OP, I think your program's going to get really complicated really fast. I'd want do define walls in a more general way, like with a separate data structure containing all the line segments or something. Then there's just no wall where the door is, and players can't get too close to any wall.