Answer the question
In order to leave comments, you need to log in
A bug in the game, can anyone look at the code and advise where I need to look?
Sometimes there is a delay in output. It seems that when the circle of animals ends, he thinks something and starts again.
Sometimes he thinks for a long time. It happens that several appear at once in one zone and abruptly disappear despite the fact that they did not click.
After I get 100 points the game goes crazy. Animals are hatched so quickly that sometimes you can’t really see them
Here is the work
https://codepen.io/fristyr/pen/xBpdXB
Answer the question
In order to leave comments, you need to log in
I didn’t go into details, but I skimmed through the code and description - you most likely have problems with timeouts. Somewhere you do not clear the interval, or set extra timers, check it all carefully.
Well, everything is correct.
Your initial speed (interval) is 2200. And the increase in speed takes away 1000, as a result, after two minuses of 1000, 200ms remains.
constructor(){
//...
this.speed = 2200;
}
setMoreSpeed(num) {
this.speed = this.speed - num;
//...
}
if (this.score % 50 === 0) {
this.setMoreSpeed(1000); //тут наверно должно было быть 100, а не 1000?))
//...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question