Touch and drag character to launch to the opposite direction

Quick question.
working on a project and need help on the character movement … trying to left click and drag / touch and drag the character, then on the point of releasing, according to the lenght in which the character was dragged … it triggers the character to jump the opposite direction ?.. how can i set this up