Reputation: 327
So I have an object that moves with "speed" now I set the code that when the object collides with another object the speed of the object decreases. I tried doing so by making the speed change and when the speed changes after 3 seconds change it back to it's original speed.
This is something I tried myself but it doesn't work. Can someone explain me what I am doing wrong, if I'm on the right track or a better way to do this? Thanks in advance
speed = 10;
if (c < r0+r1) {
lives -=1;
speed = 5;
if(speed === 5){
setTimeout(speed =10 ,3000);
}
Upvotes: 0
Views: 382