You can make a variable which is for example 0 when the player can control the hero, and 1 when the hero is hurting (lets call it HERO_STATE). Like a very basic state machine. And an other variable will also be good to detect which direction should the hero "hurt" (HERO_DIRECTION). So, I would make it like something like this:
-- enable Hero player input
+ add standard movement events here as subevents
- HERO_STATE = 1 and HERO_DIRECTION = 0
-- hero -> move left
-- wait x
-- set HERO_STATE = 0
- HERO_STATE = 1 and HERO_DIRECTION = 1
-- hero -> move right
-- wait x
-- set HERO_STATE = 0
- on hero collision with enemy
-- set HERO_STATE = 1
-- disable Hero player input
-- hero -> jump
-- set HERO_DIRECTION = Hero.X < Enemy.X ? 1 : 0
You also should handle when they are at the same position, or let it be like this.