Im doing a ball game and is working on the pass and shoot funktions.
Right now im doing so that i have the ball x and y and while the ball hasent intesected with a player it moves 3 pixels in the dir towards the player. 3 pixels in x and 3 in y until the ball have the same x and y as the player.
The problem is that this dont look nice at all.. the ball is moving werry bad.
I was woundering if anyone have a better idea in how to make this look better and natural.
I have been thinking about using pytagoras mathematics to calculate the length of the hypotenusa(i spell bad i know
) and by that somehowe make the ball go 3 pixels on that line.. but the problem is in how to calculate the x and y to the endpoint..
But someone may have a mutch better sulution..
Thanks for your time...