The easiest way is set a invisible sprite with the collision box covering all the desired area, then, check if the player is overlapping this area, if not, set the Player to a specific location.
The exception can vary, like disabling the control of the player if he go out the area, or, roll him back to the area, etc.