Hi,
(sorry if my english is not understandable enough)
I have created a program where user can define start point and destination point with a mouse. After doing this line is drawn between these points(coordinates using drawLine).
Then I have this Run button and when it is pressed letter X starts to move to a direction which is "hard coded" to method (updateXPosition). This letter X moves once in a second(I am using thread and timer but timer is for other purposes). Starting point of letter X is start point(point what user has pressed first).
So I know:
+ coordinates of the start and destination
+ when to move letter X (thread/timer, it has to move once in a second)
+ coordinates where to start to move letter X
+ my current location (X current location)
My problem is:
How do I get that letter X to moves towards destination point once in a second???
What is a simpliest way to do it with my code??
Below is code of the program:
it is quite long but I really need help with this one.. Tried for days to solve this problem.
"Main"
Class for Global variables
[code]
/* This class exist because it is easiest way to use "global" variables
*
*/
public class Global
{
// Must have some value at beginning otherwise main does not work as it should be
public static int gX1 = 5;
public static int gY1 = 5;
public static int gX2 = 5;
public static int gY2 = 5;
public static int secondFromBeginning = 0;
public static int sailLocationX = 10;
public static int sailLocationY = 10;
public static double distance = 0;
public static int counter=1;
public static int xx = 0;
public static int yy = 0;
}
[code]