function newmove() { if ( this.moved == false ) move(..); this.moved = true; } function onMovementFinished() { this.moved = false; newmove(); }