# Move a sprite in a sine wave along different angles

I understand this piece of code

Enemy.position.Y = StartPosition.Y + (-(float)Math.Cos(position.X / 100) * 100);

However it only works along the X axis. What I want to be able to do is move it along an arbitrary axis; Set an angle as the x axis. How would I go about this?

t=(t+wavespeed)%TwoPi;

t controls the waving motion; the wavespeed variable is a small value like 0.01 (note that it should slowly range from 0 to TwoPi). amplitude is the maximum you want your sprite to move, a is calculated as the amplitude for that frame. angle is the angle of the axis you want your sprite to wave along.