advance method
Makes the next waypoint of this path active. If the path is looped and returns true, the path starts from the beginning.
Implementation
Path advance() {
_index ++;
if ( ( _index == waypoints.length ) ) {
if ( loop == true ) {
_index = 0;
}
else {
_index --;
}
}
return this;
}