Is there a way to lock the camera on a charter?

So I am trying to make a game with a 2d lock.

Something like that but obviously the player can look around is there a way to lock the camera but also have it follow them? I’m no very good at programming.