I am trying to write a program where an object moves in a direction at a certain speed. Java does not have any built in function to determine direction. How would I write the Scratch Code below in Java? Also is there a way to make an object point at another object?
Screenshot of Scratch code to make object move in a direction or point toward mouse
I want the code to look like this:
public void move(int direction, int distance) {
// 0 degrees is up, 90 is right, 180 is down, 270 is left.
}
Also if you feel there is a better way to ask this question, please give me tips, this is my first question on this site.