yes I did that:
public void headTowardsDestination(){
if(!this.destinationReached){
int currentX = this.currentPosition.getX();
int currentY = this.currentPosition.getY();
int destinationX = this.destinationPosition.getX();
int destinationY = this.destinationPosition.getY();
if(currentX < destinationX){
this.currentPixelX++;
}else if(currentX > destinationX){
this.currentPixelX--;
}else if(currentY < destinationY){
this.currentPixelY++;
}else if(currentY > destinationY){
this.currentPixelY--;
}
}
}
But where should should I assign destinationReached = false; ?