2d Side scroller OnComponentHit Actor BP question

Setting up a basic 2d side scroller with some sprites such as cactus and other various items. When the player touches the cactus they are suppose to lose HP, but the OnComponentHit is making my char lose HP as long as I have the D key held down, it’s like he is constantly trying to run into the cactus.

What would be a better way to do this? Have the cactus knock him back? If so, how would I achieve that effect?

Also, if I jump on top of the cactus the player will take the normal .25 damage but when I start walking off the cactus he takes no additional damage. It’s only when I run into the side of the cactus that his HP will continue to drop as long as I’m pressing the D key.

It’s just been a good while since I’ve played any 2d side scrolling games so not sure if this is a normal mechanic in those games or if there would be a better approach to it.

Also, another quick question on that subject, would it be best to check the players health inside the Actor BP to tell if he should die or should I have a Event Tick inside the Character BP to check his health every tick to determine if he dies?

Trying to figure out the best way to set this up with minimal mess inside all the BPs.

This happens because the way collision engine works.
Character’s collider penetrates the other meshe’s collider and then is expelled back; you keep pressing the key to move and that process repeats, firing off the collision event again and again. I’ve seen old games workaround this with the old ‘blink’ trick (character is hurt then starts to blink and can’t be damaged again until blink timer runs out).

Appreciate it, I will look into the blink effect and try to create that to counter the issue. Just haven’t been lucky in finding a **** load of tutorials on 2d projects like you can find on 1st person or 3rd person games.

That little amount of docs and tutorials is due to the fact most people making 2D games aren’t using Unreal Engine.

I hopefully can finish this project I’m working on and maybe others that wish to use UE to make 2d games can learn from it.