# Knockback to zone on non-rectangular field

I have a playing field which is divided in 4 zones (as seen on the image below)

The player (blue) is on the second zone while there are 2 enemies (red) on the third zone. When the player throws an object and hits the enemy, the enemy is knockbacked in the next zone (4) but should stay within that zone.

If the enemy was being hit on the edge of the zone, I want him to still be in the zone 4 and not outside of it (if he got knocked back). I'm not sure if the direction of the hit matters in the calculation

Question: How can I find X?

Note that it can be on any shape of playing field (triangular, hexagonal, circular, ...)

• Can you unpack that "according to the direction of the hit" in more detail? It looks like both X marks in your example moved straight leftward, even though they were hit from different directions. So what influence should the hit direction have, in other cases? – DMGregory Jan 26 '20 at 22:08
• Sure to elaborate a bit more: if the enemy was more to the top of the circle (Y increase) and was being hit, I want him to still be in the zone 4 and not outside of it (if he got knocked back). I'm not sure if the direction of the hit matters in the calculation. – XverhelstX Jan 26 '20 at 23:21
• I've added a bit more context to the question – XverhelstX Jan 27 '20 at 9:01