How to Make Horizontal Gravity Change on Tap

I’m making a 2D game for smartphones and I have an object which I want to add horizontal gravity to.

Basically I have a character and I want it to have gravity-like effect (moving slowly and picking up speed - you could say like Flappy Bird), but horizontally - left/right.
My first question is what is the most appropriate way to do it?

I’d also like to make a script which would change the direction of “gravity” when you click or tap on the screen.

So a character moving left or right in gravity-like effect and changing direction of moving by tapping onto screen.

I’d really appreciate any help.

most easy solution is modify gravity vector Physics2D.gravity

But if you have rigidbody not only on character and need to change gravity only for character then this is not best solution, then you need custom gravity emulation in script for example like this (remember to set gravity scale on character’s rigidbody component to zero):

private int sign = 1;
    private Rigidbody2D Body;
    void Awake()
   {
     Body = Getcomponent<Rigidbody2D>();
   }

    void FixedUpdate()
    {
      if Input.GetButtonDown("Flip")
      {
        sign *= -1;
      }
      Body.AddForce(sign * Vector2.right * 9.8 * Time.deltaTime);
    }

put instead of 9.8 variable that can be changed in range 0 - 9.8 if you need speed up or slow down gravity affection level