I have an array of 10 cars.
The current car represented by
let currentCarIndex = 0;
let currentCar = cars[currentCarIndex];
and to get next car I increment the currentCarIndex
by 1.
When the current car crashes, play the animation.
currentCar.play("crush");
currentCarIndex++;
currentCar = cars[currentCarIndex];
But it doesn’t play the animation. It switches to next car immediately.
How to make it play the animation, and the switch to the next car ?