Set initial direction of motion

The last two statements in Listing 2 are new to this lesson.

The value stored in the global variable named dir controls the direction of motion for the ball in Figure 1.

Only four directions are allowed.

The correlation between the value of dir and the direction of motion is: