I had done this capx for the very same question a while ago.
Look through the forum there is a topic with more examples and explanations.
Edit: also IMO, sine is not the most appropriate way to do scrolling enemies, but the choice is yours.
Be sure to have a look at the how do I FAQ it has many exmaples listed amongst which making patrolling enemies with platform behavior.