There are several factors that affect a falling object as it hits the ground
You can adjust for the loss of energy during a bounce by adding a "restitution" factor.
Essentially, restitution represents the bounciness of the ball and ranges from 0-1.
Restitution==0 means the ball doesn't bounce at all--it stops on the ground like a bowling ball.
Restitution==1 means the ball doesn't lose any velocity at all during a bounce.
To implement restitution, you just multiply velocity by restitution:
vy *= restitutionFactor;
If your ball is dropping at an angle, you might also consider implementing "friction" which is an adjustment to directional velocity during a bounce.
Friction represents the loss of directional velocity when your rough ball "rubs" on the floor.
Friction is represented by values from 0 to 1 and is implemented like restitution:
vx *= frictionFactor;
A step-by-step illustration
Assume on Frame#1 the ball has not bounced and is above the ground.
Assume on Frame#2 the ball has bounced and is back in the air.
You have these calculations to make to get Frame#2 ball position.
(1) Save the ball's initial position and initial velocity (we'll need them later):
startingY = ball.y;
startingVelocity = vy;
(2) The ball uses part of the Frame-time to drop to the ground:
ball.y = bottom;
(3) The ball hits the ground and reverses velocity:
vy* = -1;
(4) The new upward velocity is adjusted by restitution and friction:
vy *= restitution;
vx *= friction; // if moving at an angle
(5) The ball used part of this frame-time moving downward, so the ball gets less than a full frame-time worth of upward velocity:
downtime = ( bottom - startingY ) / startingVelocity;
uptime = (1 - downtime);
(6) The ball bounces upward for the appropriate fraction of a frame and at the new velocity:
ball.y += vy * uptime;
There's another factor you can introduce--ball "smush".
Smush means the ball becomes temporarily flat on its bottom when hitting the ground.
During smush, velocity is suspended. So smush is a delay-time.
Smush varies with the resilience of your ball...more resilience == more smush delay.
You adjust for smush by reducing the "uptime" that the ball can use to move upward.
Revisiting step#5:
uptime = (1 - downtime - smushtime);
These are the standard adjustments to a moving ball...enjoy!