Press the LEFT or RIGHT keys to move around.
This function will calculate the offset x and y position of the layer depending on
cy values and a factor
f that determines
how fast each layer should move. It will also make sure the offset remains positive
and an integer.
All layers will repeat themselves if either the
repeat_y properties are set to true.