Ejemplo n.º 1
0
def setup(hive, packet, field_info, indices):
    """Sets up the variables and classes for the hivemind.
    
    Arguments:
        hive {Hivemind} -- The hivemind bot helper process.
        packet {GameTickPacket} -- Information about the game.
        field_info {FieldInfoPacket} -- Information about the game field.
        indices {set} -- Set containing the indices of each agent the hivemind controls.
    """

    # Game info
    hive.time = 0.0
    hive.dt = 1.0 / 120.0
    hive.last_time = 0.0
    hive.r_active = False
    hive.ko_pause = False
    hive.m_ended = False
    hive.gravity = -650.0

    # Hivemind attributes
    hive.team = packet.game_cars[indices.copy().pop()].team
    hive.strategy = None

    # Creates Car objects for each car.
    hive.drones = []
    hive.teammates = []
    hive.opponents = []
    for index in range(packet.num_cars):
        name = packet.game_cars[index].name
        if index in indices:
            hive.drones.append(Drone(index, hive.team, name))
        elif packet.game_cars[index].team == hive.team:
            hive.teammates.append(Car(index, hive.team, name))
        else:
            hive.opponents.append(Car(index, (hive.team + 1) % 2, name))

    # Creates a Ball object.
    hive.ball = Ball()

    # Creates Boostpad objects.
    hive.l_pads = []
    hive.s_pads = []
    for i in range(field_info.num_boosts):
        pad = field_info.boost_pads[i]
        pad_type = hive.l_pads if pad.is_full_boost else hive.s_pads
        pad_obj = BoostPad(i, a3v(pad.location))
        pad_type.append(pad_obj)
Ejemplo n.º 2
0
def setup(s, p, fi, indices):
    """Sets up the variables and classes for the hivemind.
    
    Arguments:
        s {BotHelperProcess (self)} -- The hivemind bot helper process.
        p {GameTickPacket} -- Information about the game.
        fi {FieldInfoPacket} -- Information about the game field.
        indices {set} -- Set containing the indices of each agent the hivemind controls.
    """

    # Game info.
    s.dt = 1 / 120.0
    s.last_time = 0.0

    s.strategy = None

    # Creates Drone objects.
    s.drones = []
    for index in indices:
        s.drones.append(Drone(index))

    # Initialises hivemind attributes.
    s.team = p.game_cars[s.drones[0].index].team
    s.strategy = None

    # Creates Car objects for teammates and opponents.
    s.teammates = []
    s.opponents = []
    for index in range(p.num_cars):
        if index not in indices:
            if p.game_cars[index].team == s.team:
                s.teammates.append(Car(index))
            else:
                s.opponents.append(Car(index))

    # Creates a Ball object.
    s.ball = Ball()

    # Creates Boostpad objects.
    s.l_pads = []
    s.s_pads = []
    for i in range(fi.num_boosts):
        pad = fi.boost_pads[i]
        pad_type = s.l_pads if pad.is_full_boost else s.s_pads
        pad_obj = BoostPad(i, a3v(pad.location))
        pad_type.append(pad_obj)
Ejemplo n.º 3
0
Archivo: data.py Proyecto: sout12/RLBot
def setup(s, p):
    """Sets up the variables and classes for the hivemind.
    
    Arguments:
        s {BaseAgent} -- The hivemind bot helper process.
        p {GameTickPacket} -- Information about the game.
        fi {FieldInfoPacket} -- Information about the game field.
    """

    # Game info.
    fi = s.get_field_info()
    s.dt = 1 / 120.0
    s.last_time = 0.0

    # Creates Car objects for all bots.
    s.teammates = []
    s.opponents = []
    for index in range(p.num_cars):
        if index == s.index:
            s.agent = Car(s.index)
        elif p.game_cars[index].team == s.team:
            s.teammates.append(Car(index))
        else:
            s.opponents.append(Car(index))

    s.agent.controller = None

    # Creates a Ball object.
    s.ball = Ball()

    # Creates Boostpad objects.
    s.l_pads = []
    s.s_pads = []
    for i in range(fi.num_boosts):
        pad = fi.boost_pads[i]
        pad_type = s.l_pads if pad.is_full_boost else s.s_pads
        pad_obj = BoostPad(i, a3v(pad.location))
        pad_type.append(pad_obj)

    s.setup = True
Ejemplo n.º 4
0
    def initialize_agent(self):
        """This runs once before the bot starts up. Initialises attributes."""
        self.agent = Car(self.index, self.team, self.name)

        # Game info.
        self.active = False
        self.time = 0.0
        self.dt = 1 / 120
        self.last_time = self.time - self.dt

        # Test related.
        self.timer = 0.0
        self.count = 0
        self.times = []
        self.distance = []
Ejemplo n.º 5
0
    def __init__(self, game_callback: GameCallback, screen: pygame.Surface):
        super().__init__(game_callback, screen)
        self._camera = Camera(self._screen)

        self._finish_line = 13.25
        self._winner = None
        self._cam_initial_pos = None

        self._mode = GameMode.START
        self._timer = 0

        # defining roads y position
        road_y_1 = 0.0
        road_y_2 = 0.2

        plus_z_value = 40.0

        # item image composite roads
        self._roads1 = construct_roads(self._camera,
                                       Vector2(0, road_y_1),
                                       'road1.png',
                                       plus_z_value=0.0)
        self._roads2 = construct_roads(self._camera,
                                       Vector2(0, road_y_2),
                                       'road2.png',
                                       plus_z_value=plus_z_value)

        # roads
        self._player1 = Player(self._camera, Vector2(0, road_y_1 - 0.08))
        self._player1.set_z_value(30)

        self._player2 = Player(self._camera,
                               Vector2(0, road_y_2 - 0.08),
                               plus_z_value=plus_z_value)
        self._player2.set_z_value(30)

        # proteins
        self._proteins1 = []
        self._proteins2 = []

        # obstacles
        self._obstacles1 = []
        self._obstacles2 = []

        # cars
        self._cars1 = []
        self._cars2 = []

        # setting the road for both player
        for protein_list, road_y in zip([self._proteins1, self._proteins2],
                                        [road_y_1, road_y_2]):
            prot_delta = -0.02
            if road_y == road_y_2:
                plus_z_value_ = plus_z_value
            else:
                plus_z_value_ = 0.0
            protein_list.append(
                Protein(self._camera, Vector2(0.8, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(0.9, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(1.0, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(1.1, road_y + prot_delta),
                        plus_z_value_))

            protein_list.append(
                Protein(self._camera, Vector2(3, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(3.4, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(3.6, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(3.8, road_y + prot_delta),
                        plus_z_value_))

            protein_list.append(
                Protein(self._camera, Vector2(4.5, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(4.9, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(5.4, road_y + prot_delta),
                        plus_z_value_))

            protein_list.append(
                Protein(self._camera, Vector2(5.9, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(6.4, road_y + prot_delta),
                        plus_z_value_))

            protein_list.append(
                Protein(self._camera, Vector2(7.7, road_y + prot_delta),
                        plus_z_value_))

            protein_list.append(
                Protein(self._camera, Vector2(8.5, road_y + prot_delta),
                        plus_z_value_))

            protein_list.append(
                Protein(self._camera, Vector2(9, road_y + prot_delta),
                        plus_z_value_))

            protein_list.append(
                Protein(self._camera, Vector2(10.6, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(11.8, road_y + prot_delta),
                        plus_z_value_))
            protein_list.append(
                Protein(self._camera, Vector2(12.2, road_y + prot_delta),
                        plus_z_value_))

        for obstacle_list, road_y in zip([self._obstacles1, self._obstacles2],
                                         [road_y_1, road_y_2]):
            if road_y == road_y_2:
                plus_z_value_ = plus_z_value
            else:
                plus_z_value_ = 0.0
            obstacle_delta = -0.01
            obstacle_list.append(
                Obstacle(self._camera, Vector2(2.5, road_y + obstacle_delta),
                         plus_z_value_))
            obstacle_list.append(
                Obstacle(self._camera, Vector2(4.1, road_y + obstacle_delta),
                         plus_z_value_))
            obstacle_list.append(
                Obstacle(self._camera, Vector2(10.9, road_y + obstacle_delta),
                         plus_z_value_))

        for car_list, road_y in zip([self._cars1, self._cars2],
                                    [road_y_1, road_y_2]):
            if road_y == road_y_2:
                plus_z_value_ = plus_z_value
            else:
                plus_z_value_ = 0.0
            rock_delta = -0.002
            car_delta = -0.02
            building_delta = -0.2
            car_list.append(
                Rock(self._camera, Vector2(5.6, road_y + car_delta),
                     plus_z_value_))

            car_list.append(
                Car(self._camera, Vector2(6.7, road_y + car_delta),
                    plus_z_value_))
            car_list.append(
                Car(self._camera, Vector2(7.1, road_y + car_delta),
                    plus_z_value_))

            car_list.append(
                Car(self._camera, Vector2(9.4, road_y + car_delta),
                    plus_z_value_))

            car_list.append(
                Building(self._camera, Vector2(12.5, road_y + building_delta),
                         plus_z_value_))

        self._add_items(self._roads1 + self._roads2 +
                        [self._player1, self._player2] + self._proteins1 +
                        self._proteins2 + self._obstacles1 + self._obstacles2 +
                        self._cars1 + self._cars2)
Ejemplo n.º 6
0
    def __init__(self,  game_callback: GameCallback, screen: pygame.Surface):
        #copy from SceneTest
        super().__init__(game_callback, screen)
        self._camera = Camera(self._screen)

        # item image background
        self._camera_background = Camera(self._screen);
        self._image_background = ImageItem(self._camera_background, Vector2(0, 0), Vector2(1, 9/16), image='background.png')
        self._add_item(self._image_background)

        # defining roads y position
        road_y_1 = 0.0
        road_y_2 = 0.2

        # item image composite roads
        self._road1 = Road(self._camera, Vector2(0, road_y_1))
        self._road1.set_z_value(20)
        self._add_item(self._road1)

        self._road2 = Road(self._camera, Vector2(0, road_y_2))
        self._road2.set_z_value(20)
        self._add_item(self._road2)

        # roads
        self._player1 = Player(self._camera, Vector2(0, road_y_1 - 0.1))
        self._player1.set_z_value(30)
        self._add_item(self._player1)

        self._player2 = Player(self._camera, Vector2(0, road_y_2 - 0.1))
        self._player2.set_z_value(30)
        self._add_item(self._player2)

        # proteins
        self._proteins1 = []
        self._proteins2 = []

        # obstacles
        self._obstacles1 = []
        self._obstacles2 = []

        # cars
        self._cars1 = []
        self._cars2 = []

        # setting the road for both player
        for protein_list, road_y in zip([self._proteins1, self._proteins2], [road_y_1, road_y_2]):
            prot_delta = -0.02
            protein_list.append(Protein(self._camera, Vector2(0, road_y + prot_delta)))
            protein_list.append(Protein(self._camera, Vector2(0.3, road_y + prot_delta)))

        for obstacle_list, road_y in zip([self._obstacles1, self._obstacles2], [road_y_1, road_y_2]):
            obstacle_delta = -0.02
            obstacle_list.append(Obstacle(self._camera, Vector2(0.8, road_y + obstacle_delta)))

        for car_list, road_y in zip([self._cars1, self._cars2], [road_y_1, road_y_2]):
            car_delta = -0.02
            car_list.append(Car(self._camera, Vector2(0.5, road_y + car_delta)))

        for protein in self._proteins1 + self._proteins2:
            self._add_item(protein)
        for obstacle in self._obstacles1 + self._obstacles2:
            self._add_item(obstacle)
        for car in self._cars1 + self._cars2:
            self._add_item(car)
Ejemplo n.º 7
0
    def __init__(self, game_callback: GameCallback, screen: pygame.Surface):
        super().__init__(game_callback, screen)
        self._state = 0
        self._t = 0
        self._t_protein = 0
        self._t_destroy = 0
        self._end_time = 0
        self._t_entree = 0

        self._zoom = 0.7

        self._camera_entree = Camera(self._screen)
        self._entree = ImageItem(self._camera_entree,
                                 Vector2(0.3, 0.2),
                                 Vector2(0.10, 0.20),
                                 image='enter.png')
        self._add_item(self._entree)

        self._camera = Camera(self._screen)
        self._camera.set_pos(Vector2(0.0, -0.3))
        self._camera.set_zoom(3.1)

        self._title = TextItem(self._camera, Vector2(0.0, -0.30),
                               Vector2(0.30, 0.10), "Gonflette Racing!")
        self._title.set_text_size(300)
        self._add_item(self._title)

        self._tuto = TextItem(self._camera, Vector2(0.0, -0.30),
                              Vector2(0.30, 0.10), "Tutorial !")
        self._tuto.set_text_size(300)

        self._credits = TextItem(self._camera, Vector2(-0.07, -0.34),
                                 Vector2(0.15, 0.02),
                                 "La famille LÉVÊQUE présente...")
        self._add_item(self._credits)

        self._player_left = Player(self._camera, Vector2(0.6, -0.1))
        self._player_left._power = 10
        self._player_right = Player(self._camera, Vector2(0.5, -0.1))
        self._player_right._power = 1

        self._player_run_w = Player(self._camera, Vector2(-0.5, 0.18))
        self._player_run_w._power = 1
        self._player_run_w.set_right(True)
        self._player_run_s = Player(self._camera, Vector2(0.5, 0.18))
        self._player_run_s._power = 10
        self._player_run_s.set_right(True)

        self._player_inflating = Player(self._camera, Vector2(-0.55, -0.1))
        self._add_item(self._player_inflating)

        self._player_car = Player(self._camera, Vector2(-0.20, -0.1))
        self._player_building = Player(self._camera, Vector2(0.15, -0.1))
        self._player_building._power = 10
        self._car = Car(self._camera,
                        self._player_car.pos + Vector2(0.10, 0.03), 0.0)
        self._car.set_size(
            Vector2(0.5 * self._car.size.x, 0.5 * self._car.size.y))
        self._building = Building(
            self._camera, self._player_building.pos + Vector2(0.10, -0.03),
            0.0)
        self._building.set_size(
            Vector2(0.5 * self._building.size.x, 0.5 * self._building.size.y))
        self._player_car.attack(self._car)
        self._player_building.attack(self._building)

        for player in [
                self._player_left, self._player_right, self._player_run_s,
                self._player_run_w, self._player_car, self._player_building,
                self._building, self._car
        ]:
            self._add_item(player)
            player.test = True

        self._proteins = []
Ejemplo n.º 8
0
class SceneIntro(Scene):
    def __init__(self, game_callback: GameCallback, screen: pygame.Surface):
        super().__init__(game_callback, screen)
        self._state = 0
        self._t = 0
        self._t_protein = 0
        self._t_destroy = 0
        self._end_time = 0
        self._t_entree = 0

        self._zoom = 0.7

        self._camera_entree = Camera(self._screen)
        self._entree = ImageItem(self._camera_entree,
                                 Vector2(0.3, 0.2),
                                 Vector2(0.10, 0.20),
                                 image='enter.png')
        self._add_item(self._entree)

        self._camera = Camera(self._screen)
        self._camera.set_pos(Vector2(0.0, -0.3))
        self._camera.set_zoom(3.1)

        self._title = TextItem(self._camera, Vector2(0.0, -0.30),
                               Vector2(0.30, 0.10), "Gonflette Racing!")
        self._title.set_text_size(300)
        self._add_item(self._title)

        self._tuto = TextItem(self._camera, Vector2(0.0, -0.30),
                              Vector2(0.30, 0.10), "Tutorial !")
        self._tuto.set_text_size(300)

        self._credits = TextItem(self._camera, Vector2(-0.07, -0.34),
                                 Vector2(0.15, 0.02),
                                 "La famille LÉVÊQUE présente...")
        self._add_item(self._credits)

        self._player_left = Player(self._camera, Vector2(0.6, -0.1))
        self._player_left._power = 10
        self._player_right = Player(self._camera, Vector2(0.5, -0.1))
        self._player_right._power = 1

        self._player_run_w = Player(self._camera, Vector2(-0.5, 0.18))
        self._player_run_w._power = 1
        self._player_run_w.set_right(True)
        self._player_run_s = Player(self._camera, Vector2(0.5, 0.18))
        self._player_run_s._power = 10
        self._player_run_s.set_right(True)

        self._player_inflating = Player(self._camera, Vector2(-0.55, -0.1))
        self._add_item(self._player_inflating)

        self._player_car = Player(self._camera, Vector2(-0.20, -0.1))
        self._player_building = Player(self._camera, Vector2(0.15, -0.1))
        self._player_building._power = 10
        self._car = Car(self._camera,
                        self._player_car.pos + Vector2(0.10, 0.03), 0.0)
        self._car.set_size(
            Vector2(0.5 * self._car.size.x, 0.5 * self._car.size.y))
        self._building = Building(
            self._camera, self._player_building.pos + Vector2(0.10, -0.03),
            0.0)
        self._building.set_size(
            Vector2(0.5 * self._building.size.x, 0.5 * self._building.size.y))
        self._player_car.attack(self._car)
        self._player_building.attack(self._building)

        for player in [
                self._player_left, self._player_right, self._player_run_s,
                self._player_run_w, self._player_car, self._player_building,
                self._building, self._car
        ]:
            self._add_item(player)
            player.test = True

        self._proteins = []

    def manage_events(self, event: Event):
        if event.type == pygame.KEYUP:
            if event.key == 13:
                if self._state != 0:
                    self._end_time = 1
                else:
                    self._state = 1

    def update(self):
        # self._car.life = 300
        # self._building.life = 300
        self._t += 1
        for player in [self._player_run_w, self._player_run_s]:
            if player.pos.x >= 0.6:
                player.pos.x = -0.6

        if self._t == 15:
            self._t = 0
            for player in [self._player_right, self._player_left]:
                player.set_up(True)
        else:
            for player in [self._player_right, self._player_left]:
                player.set_up(False)

        self._player_inflating.loose_power()
        self._t_protein += 1
        if self._t_protein == 35:
            self._t_protein = 0
            self._proteins.append(
                Protein(self._camera, Vector2(-0.55, -0.4), 0.0))
            self._add_item(self._proteins[-1])

        for protein in self._proteins:
            protein.move(Vector2(0, 0.01))
            if protein.pos.y >= -0.1:
                self._remove_item(protein)
                self._proteins.remove(protein)
                self._player_inflating.gain_power()

        self._t_destroy += 1
        if self._t_destroy >= 50:
            self._t_destroy = 0
            for item in [self._car, self._building]:
                self._remove_item(item)
            self._car = Car(self._camera,
                            self._player_car.pos + Vector2(0.10, 0.03), 0.0)
            self._car.set_size(
                Vector2(0.5 * self._car.size.x, 0.5 * self._car.size.y))
            self._building = Building(
                self._camera, self._player_building.pos + Vector2(0.10, -0.03),
                0.0)
            self._building.set_size(
                Vector2(0.5 * self._building.size.x,
                        0.5 * self._building.size.y))
            for item in [self._car, self._building]:
                self._add_item(item)
            self._player_car.attack(self._car)
            self._player_building.attack(self._building)

        TT = 15
        if self._state and self._state < 15:
            if self._state == 1:
                self._add_item(self._tuto)
                self._remove_item(self._title)
                if self._entree in self._items:
                    self._remove_item(self._entree)
            self._state += 1
            lb = self._state / TT
            self._camera.set_pos(
                Vector2(0.0, 0.0) * lb + (1 - lb) * Vector2(0.0, -0.3))
            self._camera.set_zoom(self._zoom * lb + 3.1 * (1 - lb))
        elif self._end_time:
            if self._entree in self._items:
                self._remove_item(self._entree)
            self._end_time += 1
            self._camera.set_zoom(self._camera.zoom * 0.9)
            self._camera.move(Vector2(-0.40 / self._camera.zoom, 0))
            if self._end_time >= 20:
                self._game_callback.set_scene_id(SceneId.FINAL)
        else:
            self._t_entree += 1
            if self._t_entree == 5:
                self._t_entree = 0
                if self._entree in self._items:
                    self._remove_item(self._entree)
                else:
                    self._add_item(self._entree)

        super().update()
Ejemplo n.º 9
0
    def update(self):
        # self._car.life = 300
        # self._building.life = 300
        self._t += 1
        for player in [self._player_run_w, self._player_run_s]:
            if player.pos.x >= 0.6:
                player.pos.x = -0.6

        if self._t == 15:
            self._t = 0
            for player in [self._player_right, self._player_left]:
                player.set_up(True)
        else:
            for player in [self._player_right, self._player_left]:
                player.set_up(False)

        self._player_inflating.loose_power()
        self._t_protein += 1
        if self._t_protein == 35:
            self._t_protein = 0
            self._proteins.append(
                Protein(self._camera, Vector2(-0.55, -0.4), 0.0))
            self._add_item(self._proteins[-1])

        for protein in self._proteins:
            protein.move(Vector2(0, 0.01))
            if protein.pos.y >= -0.1:
                self._remove_item(protein)
                self._proteins.remove(protein)
                self._player_inflating.gain_power()

        self._t_destroy += 1
        if self._t_destroy >= 50:
            self._t_destroy = 0
            for item in [self._car, self._building]:
                self._remove_item(item)
            self._car = Car(self._camera,
                            self._player_car.pos + Vector2(0.10, 0.03), 0.0)
            self._car.set_size(
                Vector2(0.5 * self._car.size.x, 0.5 * self._car.size.y))
            self._building = Building(
                self._camera, self._player_building.pos + Vector2(0.10, -0.03),
                0.0)
            self._building.set_size(
                Vector2(0.5 * self._building.size.x,
                        0.5 * self._building.size.y))
            for item in [self._car, self._building]:
                self._add_item(item)
            self._player_car.attack(self._car)
            self._player_building.attack(self._building)

        TT = 15
        if self._state and self._state < 15:
            if self._state == 1:
                self._add_item(self._tuto)
                self._remove_item(self._title)
                if self._entree in self._items:
                    self._remove_item(self._entree)
            self._state += 1
            lb = self._state / TT
            self._camera.set_pos(
                Vector2(0.0, 0.0) * lb + (1 - lb) * Vector2(0.0, -0.3))
            self._camera.set_zoom(self._zoom * lb + 3.1 * (1 - lb))
        elif self._end_time:
            if self._entree in self._items:
                self._remove_item(self._entree)
            self._end_time += 1
            self._camera.set_zoom(self._camera.zoom * 0.9)
            self._camera.move(Vector2(-0.40 / self._camera.zoom, 0))
            if self._end_time >= 20:
                self._game_callback.set_scene_id(SceneId.FINAL)
        else:
            self._t_entree += 1
            if self._t_entree == 5:
                self._t_entree = 0
                if self._entree in self._items:
                    self._remove_item(self._entree)
                else:
                    self._add_item(self._entree)

        super().update()
Ejemplo n.º 10
0
#!/usr/bin/env python3
from flask import Flask, Response, send_from_directory
from flask_socketio import SocketIO, emit

from utils import Car, stream

app = Flask(__name__)
socketio = SocketIO(app, cors_allowed_origins="*", logger=False, engineio_logger=False)
car = Car()


@app.route("/")
def main():
    return send_from_directory("../client/public", "index.html")


@app.route("/api/video_feed")
def video_feed():
    return Response(stream(), mimetype="multipart/x-mixed-replace; boundary=frame")


@app.route("/<path:path>")
def wildcard(path):
    return send_from_directory("../client/public", path)


@socketio.event
def connection(data):
    print("connection established")
    emit("acknowledge")
Ejemplo n.º 11
0
import pygame
import utils
from utils import Car
from constants import *

pygame.init()
pygame.display.set_caption('ParkingGaucho')
screen = pygame.display.set_mode((1280, 800))
playing = True
fps = 60
current_level = 0
direction = starting_dirs[current_level]



car = Car(starting_pos[current_level], car_img, direction)

while playing:
    pygame.time.Clock().tick(fps)
    screen.fill(0)
    screen.blit(parking[current_level], (0, 0))

    utils.commands()
    utils.afficher_pieces(screen, current_level)

    rect = pygame.transform.rotate(car.img, car.direction).get_rect(center=car.pos)
    screen.blit(pygame.transform.rotate(car.img, car.direction), rect)
    car.move()