If it’s a tile based game, you can try to move temporarily the player then if it collides with something you don’t move it.
Or you before you move you can check if the corresponding tile (up, down, left, right) has a wall and if yes you don’t move.
If it’s a tile based game, you can try to move temporarily the player then if it collides with something you don’t move it.
Or you before you move you can check if the corresponding tile (up, down, left, right) has a wall and if yes you don’t move.