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.