Game Development Reference
As you can see from the complete method description, the code of the y-direction is
similar. Finally, we call the currentPos mutator to set the new position based on the
change in displacements. Recall that this is a custom mutator that also tells the operating
system to update the display. After the draw method is finished, the accelerometer waits
1/60 of a second and then calls it again. You could extend this program by adding in
friction, fluid resistance, and collisions with the screen boundaries using the methods
outlined in the other chapters of this topic.