From which side character is getting hit?

I am working on a fighting game (punch/kicks), when the player get hit i play it’s falling animation and apply physics to throw him away a little bit using setLinearVelocity. but i don’t know on which direction to throw him? How can i know if the character got punches from right or left? so if the enemy got hit from right i can throw him on the left and vice versa.

Let me explain further with this image…

direction.jpg

You could use object.xScale to see in which direction the enemy is looking. 

Add a if-statement at the beginning of your “throw” implementation and check if object.xScale is 1 or -1

Or just check x or y (portrait or landscape mode) of fighter and enemy and compare them on collision ?

How do i do this calculation? I mean compare x and y of both characters?

event.target.x and event.other.x

Let me explain further with this image…

direction.jpg

You could use object.xScale to see in which direction the enemy is looking. 

Add a if-statement at the beginning of your “throw” implementation and check if object.xScale is 1 or -1

Or just check x or y (portrait or landscape mode) of fighter and enemy and compare them on collision ?

How do i do this calculation? I mean compare x and y of both characters?

event.target.x and event.other.x