Move y offsets into a dictionary

Provides a more concise way of storing the offsets rather than a long string of if statements.