Hello, I would like simulate road in my game, and for this i use road's lanes and traffic, lanes and traffic dynamic created like this
if(roadlineTimer-- == 0){
roadlineTimer = 30;
newRoadline = new Roadline();
newRoadline.x = 0;
newRoadline.y = 0;
newRoadline.speed = 3;
roadlines.push(newRoadline);
addChildAt(newRoadline,numChildren-1);
}
But when complile and run this code. I have visible delays. My lane likes as rectangle and have own class. How I can optimize this code