[SOLVED] Is it possible to while holding attack button 1st 1 sec delay once then 0.02 deal between attack?

I have attack that i limit by timer to set how often player repeat attack on it own while holding attack button
I was able to change delays between repeated attacks with simple condition to The timer COOLDOWN of Player is > greater than 0,2 and then followed it by condition start or reset timer COOLDOWN of player
Problem is i wish to make it so 1st attack just happens then wait 1 sec and after that 1st one second delay go to each following attack would be in intervals of 0,2
Any1 know any way to achieve that?

Add an attack_counter variable to the player, so then just check if key β€œx” pressed and attack_counter = 0 and timer < 1 do the attack thing and set attack_counter to 1
then check if the attack_counter is > 0 and timer is > 0,2 and key β€œx” pressed do the rests of the attack things finally set the attack_counter back to 0

1 Like

I did try your method but i end up in either need to double click after attack to be able to attack again
Or not being able to attack at all after 1st attack

Can you show me example of how it should look like?

Correct me if I have this wrong. The way I understand it is that you want to start an attack when the key is pressed and repeat the attack every 0.2 second intervals while the button is pressed. Then when the key is released, there is a 1 second delay before the attack can start again?

1 - you press attack button (and hold it all the time)
2 - ONE attack is made and there is 1 second pause
3 - after that 1 second it goes to spamming attack 0,2 per sec
I forgot about it but
4 - no matter the cooldown pressing attack repeatedly

example (space to attack)
https://maxkratt.github.io/unitycraft/game.html

Ok, so something like this?

Does not work for me


But my version is based on animation change + creating object then changing animation back and removing that object
But i did try with just animation change
I guess my problem is that there is no action to change animation back and delete objects so it wont work
While for you it can since you just fire bullet and you don’t need to do anything with it from that point on

Nope sorry again you are the CHAMPION :stuck_out_tongue:
Works perfectly fine
I was stupid not to try with rest of my attack actions
I added wait 0.06
Then set animation back to idle
And it works exactly as it should
Now i gonna just add rest of actions of my attack event and im set
Again BIG THANK YOU <3