Draw Anna/Elsa circles more nicely by turning during same frame as forward move

Nice.  Had to move scope of executeSecondTuple, and add an additional check
to only smooth animate for Anna & Elsa, but this has advantage of a new
flag in skin which could be used in a lot more of turtle.js.

On Thu, Nov 20, 2014 at 1:52 PM, Bjvanminnen <notifications@github.com>
wrote:

> In blockly/src/turtle/turtle.js:
>
> >    }
> > +
> > +  return true;
> >  }
>
> What do you think about this? I think it accomplishes the same thing
> (please double check for me) but manages to have fewer variables one needs
> to track:
>
> function executeTuple () {
>
>   if (api.log.length === 0) {
>     return false;
>   }
>
>   do {
>     // Unless something special happens, we will just execute a single tuple.
>     var executeSecondTuple = false;
>
>     var tuple = api.log[0];
>     var command = tuple[0];
>     var id = tuple[tuple.length-1];
>
>     BlocklyApps.highlight(String(id));
>
>     // Should we execute another tuple in this frame of animation?
>     if (skin.consolidateTurnAndMove && checkForTurnAndMove()) {
>       executeSecondTuple = true;
>     }
>
>     // We only smooth animate for Anna & Elsa, and only if there is not another tuple to be done.
>     var tupleDone = Turtle.step(command, tuple.slice(1), {smoothAnimate: !executeSecondTuple});
>     Turtle.display();
>
>     if (tupleDone) {
>       api.log.shift();
>       clearTuple();
>     }
>   } while (executeSecondTuple);
>
>   return true;
> }
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/code-dot-org/code-dot-org/pull/478/files#r20680300>.
>