How do professionals do boundaries in a 2D game? The way I do is say I don't want the sprite to move into a certain area:
//Example
if ((playerPosX >= 825) && (playerPosX <= 910)&& (playerPosY >= 170) && (playerPosY <= 255)) {
//do nothing
}else{
//move
}
But some games out there have a lot of boundaries so I'm wondering, is there an easier way. I don't think there is any way someone would use the above method throughout a whole game, just to block of movement.
EDIT: My question is mainly regarding a game where you can walk around, similar to Pokemon or final fantasy