How can I make a boundary that the player can not exit while the enemies can?
Think arkanoid or breakout, theres a wall the player cant exit.
But, then, unlike those games, the enemies can.
Develop games in your browser. Powerful, performant & highly capable.
If it is single screen game, just add sprites that cover edges of the screen (outside view, if you want), then in the movement code check for collision with the player only.
Alternatively, you can alter movement to only be able to move within limits ( 0<x<DisplayWidth, 0<y<DisplayHeight) for the player only.
Worked like a charm. Thanks.