April 2018
Beginner
714 pages
18h 21m
English
Instead of performing actions immediately, upon pressing a key, we are now setting flags (in a private object) for which direction the character should be moving in. In our situation, the right direction has priority over the left direction. Setting a flag triggers an animation that tries to move the character toward an edge of the scene. Releasing the button will clear the flag and stop the animation. Before the animation is started, we are calling the recalculateDurations() function, which checks how long the animation should last for the character to move at the desired speed.
Read now
Unlock full access