The sloping walls (called a batter) have a couple of functions. Firstly, they strengthen the base of the wall and make it more resistant to mining or attacks with battering rams or picks. Secondly, they make it much harder to assault with ladders or siege towers. The slope means that a siege tower cannot come next to the parapet and wallwalk, and ladders must be much longer and at a dangerous angle.
Can you explain how they resist sapping? I had heard that before but couldn't find an explanation....