def draw(self, screen): ''' @brief Dibuja el coche por pantalla y los puntos por los que tiene que pasar ''' BasicCar.draw(self, screen) #Mostramos cada uno de los puntos for point in self.left_points: pygame.draw.rect(screen, (0, 0, 0), (point.rect.x - self.game_control.circuit_x(), point.rect.y - self.game_control.circuit_y(), point.rect.w, point.rect.h), 1)
def __init__(self, game_control, xml_file, x, y, angle = 0): BasicCar.__init__(self, game_control, xml_file, x, y, angle) #Simulación se Switch de C o C++. #Según el estado llamaremos a una función u otra. self.states = { NORMAL: self.__normal_state, RUN: self.__run_state } self.falling = False self.min_scale = 0.3 self.count_scale = 0.02 self.actual_scale = 1 self.target_angle = self.target_x = self.target_x = 0
def __init__(self, game_control, xml_file, x, y, angle = 0): ''' @brief Constructor. @brief game_control Referencia a GameControl @brief xml_file Archivo xml con las características @brief x Posición x @brief y Posición y @brief angle Ángulo inicial del vehículo ''' BasicCar.__init__(self, game_control, xml_file, x, y, angle) #Simulación se Switch de C o C++. #Según el estado llamaremos a una función u otra. self.states = { NORMAL: self.__normal_state, NOACTION: self.__normal_state, RUN: self.__run_state, DAMAGED : self.__damaged_state } self.falling = False self.min_scale = 0.3 self.count_scale = 0.02 self.actual_scale = 1 self.target_angle = 0 #Donde almacenaremos los objetivos a los que queremos llegar self.left_targets = self.passed_targets = deque() self.actual_target = None #Donde almacenaremos los puntos intermedios para llegar a los objetivos self.passed_points = self.left_points = deque() self.actual_point = None #Instancia del algoritmo A* del vehiculo self.astar = astar.Astar()