I\'m new to JS, and decided to start of learning by a making a small game. I am using a setInterval to automate the enemy\'s attack. For their first attack the interval is corre
You keep calling 'setInterval' again again. Each call is running in parallel.
If you have more than one warrior peer type (archer, knight, etc), create an array that will have a separate set interval for each.
If, as seems the case, you only have one and they play at random each turn, add clearInterval
before every setInterval
you should never use setInterval for animations!
requestAnimationFrame
instead!