code-dot-org/blockly — pull request #522 by Bjvanminnen (2014-04-24 18:58:16+00:00)
Title: refactor schedule to be scheduleMove or scheduleTurn

More animation related refactoring in preparation for step mode. We had a schedule method that took in two arrays of inputs (confusing) and scheduled animations. Looking at callers, we would only change the direction or the location - never both - so I changed it to be scheduleMove and scheduleTurn. I then also refactored the code some, enough that it may not be entirely clear what's happening in the diff. Let me know if you have questions.

I also renamed direction4to16 to be directionToFrame as what it's doing is using the direction to figure out which frame from an animation is needed. I also moved the constraint that it be in the range 0-15 into directionToFrame, which allows us to get rid of constrainDirection16.