Oh, that’s an easy one. Let’s work through this. I’ll explain how I see it and you can try it. If after this you get stuck - we’ll work things out.
So, based on your video, you want to move the camera in horizontal space. That is a bit different than bidirectional. Also, you want it to be glued to your player object, and not worry about being within a boundary box of a player.
So here’s an approach I would take:
- Store player position of the previous frame
- Get current player position
- Has the player moved? (if x positions are different - he has)
- Figure out by how much has he moved?
- Now moving player right is essentially the same as moving the world left (that whole theory of relativity)
- So as your player moves - you move the world in the opposite direction
Does this approach make sense?