Then u need to provide more code to understand how ur camera and hero moves.
To limit the position u need to check for min and max values:
Game area width = 2000
stage width = 700
(Max x) Left area bound x = 0
(Min x) Right area bound x = 700 - 2000 = -1300
If the “camera” is just the game canvas Sprite, just position game canvas relative to
-hero.x + stage width / 2 (if u want it always centered)...
then a few ifs to limit the camera movements based on the sample i gave before.
this is for a simple logic, if u are using a game engine or something, then i have no clue 🙂
Sorry for the lack of formatting and clarity, i am replying from my phone