import sumolib from Car import Car class CarController: def __init__(self,path,parentMap,surface): self.map=parentMap self.surf=surface self.cars=[] self.fromPath(path) def fromPath(self,path): for vehicle in sumolib.xml.parse(path,"vehicle"): route=vehicle.route[0].edges.split() self.cars.append(Car(vehicle.id,route,self.map,self.surf)) def update(self): for car in self.cars: car.update(1.0/60) def draw(self,screen): for car in self.cars: car.draw((255,255,255)) screen.blit(self.surf,(0,0))