Need help with attacks

Ok so I have it set up so that I can press space to make a wave-slash type attack at my enemies.
Its also set up so that when I touch an enemy it damages me… I would like to have a delay so that I can’t just spam the space button and instantly kill my enemy
I also want it so that my enemies will not kill me the second I touch them, I want like a knockback effect and a delay between the damage i take, something like invincibility frames for both me and the enemies. Cause sometimes when I attack, it’s not supposed to instantly kill the enemy but sometimes it does. I’m thinking its because the enemy is in constant contact with the attack because it’s trying to run at me, so it’s running into the slash so it’s constantly taking damage, and this kills it instantly. I believe I need a sort of delay so that it doesn’t instantly die, like a delay so that its health doesn’t just run down instantly due to constant contact. And I’d also like this for my player as well, because I die due to constant contact with the enemy, if I’m unable to get away from it. For this I wanted a knockback effect of some kind.

Also, i have a shield button that is set to shift; I was wondering if there was a way to make it so that as long as i hold down the shift button, the shield will be there blocking anything; and when I let it go, the shield goes away.

My game link is here: http://flowlab.io/game/view/733749

Thanks in advance <3

That’s a lot of things… alright.

1( attack delay): To do that you have to use 2 Timers behaviour and a switch. This one will have an image because i can’t explain it. (ignore the background game)
qqqqqqqqqe
(The timer that turns off the switch put 0 as delay) (The Timer that turns on the switch put the time you want it to have as cooldown)

2(knockback): use an collision, number, impulse behaviours.

3 (shield hold): it’s really simple
qqqqq

Hey, I appreciate all the help :smiley:

I’d like to ask for one last thing regarding this post;
How do I make it so that when I get hit, there’s something like invincibility frames. I don’t need an animation or anything I just mean, a moment of invicibility so that I’m not taking constant damage on contact with an enemy. Because I notice that when I run into them I die instantly, and sometimes they die instantly from my attack just from touching it once.

Thanks in advance <3

I’m not sure but i think you could do that with some proximitys behaviours with delay and you could use an Alpha that goes from 30 to 70 like a blink… that could look nice

Try a specific collision to turn off a switch that you use for damage. Idk where you keep your damage tick, but let’s say it’s like

Collision enemy > (+)number > filter > die

Make it like this
Collision enemy > (in)On/Off >(+)number > filter > die

  • Collision also > Timer 0 > (off)On/Off
    Timer also > number 50 also number 100 > Ease elastic (out) > Alpha
  • Collision also > Timer 15 > (on)On/Off

You should now get hit and be invincible and flicker for 1.5 seconds.

thank youuuuu<3

can u explain the knockback a bit more

Like on what a bullet or a person

and what does the number do and impulse?

Pardon what is ease elastic

This is Helpful!
Once im done with my current game i will send the link!!!