Help me with maths on my program!

Hello, i am in need of help with doing some calculations on my program. I am not really in all the math functions but i want to learn the way how can i calculate the right x and y speed for ball to go on correct angle. like if ball's y speed was 1 it would go just up. (0°) Actually i want the ball go in the direction of certain position to mouse's position. Can anyone help me with this, i found much similar stuff to this but not well explained. Heres example: YouTube - Little Java game also theres source for the code used but its commented in norway and the maker havent responsed yet. Can you guys please help me with this?

This was not about managing to do it, i want to learn the way how to do it. I did it with the help of the code from the video i linked and it works, but now i want to figure out why it works, where do i need squareroot of distances and so on. I show you the code and please explain the calculation part for me if you're such kind person! :)Java | import java.awt.Dimension; import java.awt.Graphi - BallTest

If you are concerned about what happens inside the sqrt method of Math class, then it's just a static method which takes the parameter and returns the positive square root of it. Have a look at Math.sqrt(double d) documentation.

If you are starting along the path of Java, I would strongly recommend you to have a look at the Java API documentation provided here: Java 6 API

There would be many things along the way, that you might not understand and going through documentation will help you out.

Best of luck,

Goldest

Java Is A Funny Language... Really!Click on * and add to member reputation, if you find their advices/solutions effective.