Moving sprite code to object