The way I would do it is, (Probably not the best way)
Make a counter that every 50 ms gets 1 subtracted from it.
Said counter has a minimal value of 0 and an initial value of 0.
When touched by an enemy the counter would be set to a value based upon how far back you want to bounce (If you want it to vary I would use an active object that changes direction and every 50 ms would - 1 dir until it reached down, down would be a substitute for 0, and you would make it randomly choose a direction to for the object to look when the character contacts the enemy)
You would make it so While Counter > 0 move player - 2x (If they were to need to move left)
And if you you could be collided from multiple directions you would need multiple counters that would react based off of the enemies direction.
I don't know how well I explained that, but there's probably a better way.