posted 13 years ago
Hello all, I'm making a game where you have to order troops around, meaning click on the destination, click on the soldier, and the soldier moves to the destination. I am having problems with the animation part, I have already figured out the MouseListener and graphics stuff. I know that you are supposed to use y = mx + b, m = y2 - y1/x2 - x1 and y - y1 = m(x - x1), but don't know how to implement this into my application, and I have been working on this for a long time with no success (hey, I'm in middle school, and I taught myself). I have a game class that contains the listeners, and a UserUnit class that contains the actual moveTo() method. Assume that I've got everything else figured out, if I don't I'll ask. Any help is appreciated, and thanks in advance.