Created Funciton for horizontal moving platforms