Hi!
I have a turret that moves in a circle around the edge of the screen, and fires towards the center of the screen. The problem is that the bullets move in an "L" shaped path instead of a nice, smooth triangular path. Here is the relevant function for the bullet -
What am I missing? How do I get the bullet to move in a diagonal?
public void moveToCenter() { if (getX() > 280) { setLocation(getX()-1, getY()); } if (getX() < 280) { setLocation(getX()+1, getY()); } if (getY() > 280) { setLocation(getX(), getY()-1); } if (getY() < 280) { setLocation(getX(), getY()+1); } }