I made a seperate sprite thats only the places where you want to be able to collide with the walls, and wrote code to move you away if you touch it. The hitbox for things you can stand on needs to be a little lower for jumping to work, and I would also recommend having the players sprite centered, as otherwise you can clip into walls.