Because the Ball class is a Sprite, but we want the given texture to be displayed, so we add it to the Ball. If you didn't have that line an empty sprite would be added to the stage and nothing would appear.
If you do not want to create a ball class, you could create a ball sprite and change the behavior. Maybe you can look at the jumping ball example for that.
In the jumping balls, the behavior of ball is encapsulated in the ball class, so you need to add the sprite and you can create more than one ball objects, which behaves similarly.
Comments
In the jumping balls, the behavior of ball is encapsulated in the ball class, so you need to add the sprite and you can create more than one ball objects, which behaves similarly.