- Home /
How to calculate attack speed
Hi there. I'm doing a solo project for self-learning in which I'm trying to do what I can to recreate League of Legends. In the original game, they use a system that is attack speed (ie attacks per second). My question is how would you implement the cooldown you'd need? For example, a 1.14 attack speed means 1.14 attacks per second. This may be a bit of a brainfart on my part but I would very much appreciate some assistance.
For a simple clarification, the inverse of attacks-per-second is seconds-per-attack, calculated as...
1(second)/attacks-per-second
(and can be converted back in the same manner).
For example, 1.14 attacks-per-second is 1/1.14 or ~0.87719 seconds-per-attack.
@Eno-Khaon I see. That makes sense. After trying it it worked exactly like I wanted after putting it in a simple Time.deltaTime timer. Thank you very much!
Answer by SellPet · Feb 11 at 06:06 PM
I dont know how LoL works but i would assume that, you can create time float: time += Time.deltaTime, when clicked attack button, and if(time >= 1) {EnemyHealth -= 1.14 * DamagePerAttack } so everysecond player hold attack button, you do damage. i hope i somehow helped
Your answer
Follow this Question
Related Questions
How to combine FindGameObjectsWithTag with AttackScript 1 Answer
Photon PUN 2 RTS one time information sharing 0 Answers
Smooth 2D collisions / colliders pushbacks 0 Answers
Calculations Wrong? 1 Answer