IRESTE/CarController.py

19 lines
508 B
Python

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"):
self.cars.append(Car(vehicle.id,vehicle.route[0].edges.split(),self.map,self.surf))
def draw(self,screen):
for car in self.cars:
car.draw()
screen.blit(self.surf,(0,0))