1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | private void swoop(){ canMoveLaterally = false ; if (swoopingDown) { setLocation(getX(), getY() + 2 ); speed += 10 ; if (getY() >= maxY) { swoopingDown = false ; // Change direction to move up } } // move back up and then only do move method until timer else { if (getY() > minY) { setLocation(getX(), getY() ); speed += 3 ; } else { swoopingDown = true ; // Reset to swoop down again canMoveLaterally = true ; speed = 5 ; } } } |

