update sprite position function

updated the sprite position function. If i use % in offset-x all is fine but if i use % in offset-y i get only px not percent. With this new if it runs the same as offset-x does.