public OscillateMovement(Vector2 origin, float velocity) { this.velocity = velocity; //Set direction to go right first this.direction = 1; move = new SingleMovement(origin, new Vector2(1, 0), velocity); }
//Called if the sprite has hit the window and switches directions if so public void SwitchDirections(Vector2 origin) { if (direction == 1) { direction = -1; move = new SingleMovement(origin, new Vector2(-1, 0), this.velocity); } else if (direction == -1) { direction = 1; move = new SingleMovement(origin, new Vector2(1, 0), this.velocity); } }