Absolute beginner here. As you can see, the first bounce works out pretty fine, but when I tried to make the ball slowly bounce to a stop like in the real world, it kept bobbing up and down in the same small space and never stopped. Also, when I tried to make it bounce off a platform instead of the edge (by replacing 'edge' with the sprite name in the code) it went right through it the first time. How do I make this work? Any additional advice to help me get better is also welcome and deeply appreciated!
Update: Fixed thanks to @StoneCascade