I have it so an enemy is hurled at the player using a bouncing ball movement. I want the initial speed to remain constant (for fairness), but the deacceleration to adjust so that the enemy will be stopped at roughly the same point behind the player (if they're standing still)
what's the formula I should use as "set deacceleration to"
Rather than set the deceleration you might want to work out the distance between the player and the enemy, and use that to set the speed. That way the closer the enemy gets, the slower it becomes.
v² = u² + 2as
v = u + at
s = ut + 0.5at²
s = 0.5(v+u)t
V is final velocity
U is initial velocity
A is acceleration
S is displacement (i.e distance between start and end point)
T is time in motion
Unless it is projected in a straight line, horizontally or vertically, it isn't straight forward, as you need to consider each component of motion seperately.
If it is projected at an angle α relative to the horizontal,
Initial velocities will be for x: ucosα
and for y: usinα
where u is the SPEED of projection (speed = resultant of the velocities)
vertically, if projected upwards, acceleration is -9.81 (or -the value of gravity. it is negative because it is projected AWAY from the direction gravity pulls in)