If you know this game maybe you can easily understand what I am asking.
I want that the tower will attack once it enters the attack perimeter so I used getBounds() with this.
And my problem is, it only attacks once. It will not attack anymore even if I am inside the perimeter.
Should I put the the attacks in ArrayList?
Thanks.
SOLUTION:
attacking = false;
posX = //starting x of the attack
posY = //starting y of the attack
x = posX;
y = posY;
if (in) {
attack(x,y);
attacking = true;
if (hit()) {
x = posX;
y = posY;
}
else if (!in) {
if (attacking) {
attack(x,y);
if (hit) {
x = posX;
y = posY;
attacking = false;
}
}