Issue with collision overlap and timers not ending

In an attempt to make a spinning attack, the current way I have it set up is a collision box, that when overlapped, and a button is held, starts a timer and damages an enemy. That works great, but it doesn’t work when the player presses that button and there’s an enemy already in the collision box. The second issue is that the timer doesn’t stop when you let go of the button so it keeps ticking enemy health down. Here’s my code for it all and a video to demonstrate, any help is greatly appreciated.

Rather than using begin and end overlap, why not use




I saw them but my coding skills are very limited and I wasn’t sure where to put them,

Just let your player do a spin whenever they want, but when they start, check to see if you are overlapping an enemy.

If it’s always the same enemy, you can use a reference and plug it into ‘is overlapping’. But if you have more than one enemy, when the player starts to spin, use ‘get overlapping actors’ and a foreach loop to check if one of them is the enemy.

If it is, you can damage them :slight_smile:

Something more like this? I feel like it’s closer but I can’t get it right

It does it once and takes off a little bit of damage but doesn’t keep doing it

Yes, does it work?

1 Like

Not quite, it does one single tick of damage when you press 2 but holding it down doesn’t do anything, unless they walk into the zone later.

And the stop handle doesn’t do anything still strangely

Yeah I’ve been playing around with it but can’t get it to work

The attack should be on the timer, like before

Thank you! This is almost perfect! The only issue is that they sometimes seem to be taking damage when they aren’t in my area. I’m not sure if that’s an issue with this or something else though.

Well, it needs a bit of tuning. Best to cast to find out if you want to damage the actor first.

Otherwise you’re probably trying to damage the floor as well :slight_smile:

A nice way, would be on overlap, check if you can attack. If you can add to a list of actors.

On end overlap, if the actor is in the list, remove it.

When the player presses the attack key, only attack if the list has at least one thing in it


I really appreciate the help, but I think that’s a bit too much for me to try and figure out.

1 Like

I will come back in a little while ( food time :slight_smile: )

No worries! I’m game jamming so I’m here all night ahaha

Something like this


Strangely that does nothing for me. How did you get that Enemies variable? is it just promoting the for each loop to a variable?

Enemies comes from here

Any actor that overlaps gets added to the variable.