def __init__(self):
     pygame.init()
     pygame.key.set_repeat(50, 5)
     self.dimensions = Dimensions(50, 50)
     self.fenetre = pygame.display.set_mode(
         (self.dimensions.width, self.dimensions.height))
     self.fenetre.fill(BACKGROUND)
     self.perso = Personnage(self, "img/perso1.png")
     self.enemis = {}
     self.position_souris = Position(0, 0)
     pygame.display.flip()
示例#2
0
 def __init__(self):
     super().__init__(pos=Position(25, 42), size=SHIELD_SIZE)
     self._image = Assets().armor
示例#3
0
 def __init__(self):
     super().__init__(pos=Position((WIDTH - INVENTORY_BAR_SIZE[0]) // 2,
                                   (HEIGHT - INVENTORY_BAR_SIZE[1])),
                      size=INVENTORY_BAR_SIZE)
     self._image = Assets().inventory_bar
示例#4
0
 def __init__(self):
     super().__init__(pos=Position(25, 15), size=HEART_SIZE)
     self._image = Assets().fullHeart
示例#5
0
 def __init__(self):
     super().__init__(pos=Position(0,
                                   (HEIGHT - EQUIPMENT_BAR_SIZE[1]) // 2),
                      size=EQUIPMENT_BAR_SIZE)
     self._image = Assets().equipment_bar
示例#6
0
 def __init__(self):
     super().__init__(pos=Position(230, 17), size=COIN_SIZE)
     self._image = Assets().coin
 def __init__(self, interface, img_path, position=Position(0, 0)):
     self.interface = interface
     self.img = pygame.image.load(img_path).convert_alpha()
     self.position = Position(0, 0)
     self.set_position(position)
     self.fleche = Fleche(interface)
 def update(self):
     x = self.interface.perso.position.x
     y = self.interface.perso.position.y
     O = y - self.interface.position_souris.y
     A = self.interface.position_souris.x - x
     H = math.sqrt(O * O + A * A)
     angle = math.acos(A / H)
     if O < 0: angle = -angle
     # self._draw(BACKGROUND)
     # print("A = {}  O = {}  H = {}  --> Angle = {}".format(A, O, H, angle))
     self.x_A, self.y_A = self._rotation(angle, Position(x, y),
                                         Position(x, y - WIDTH_ARROW / 2))
     self.x_B, self.y_B = self._rotation(angle, Position(x, y),
                                         Position(x, y + WIDTH_ARROW / 2))
     self.x_C, self.y_C = self._rotation(
         angle, Position(x, y),
         Position(x + HEIGHT_ARROW, y - WIDTH_ARROW / 2))
     self.x_D, self.y_D = self._rotation(
         angle, Position(x, y),
         Position(x + HEIGHT_ARROW, y + WIDTH_ARROW / 2))
     self.x_E, self.y_E = self._rotation(
         angle, Position(x, y),
         Position(x + HEIGHT_ARROW, y - WIDTH_ARROW / 2 - WIDTH_ARROW_2))
     self.x_F, self.y_F = self._rotation(
         angle, Position(x, y),
         Position(x + HEIGHT_ARROW + HEIGHT_ARROW_2, y))
     self.x_G, self.y_G = self._rotation(
         angle, Position(x, y),
         Position(x + HEIGHT_ARROW, y + WIDTH_ARROW / 2 + WIDTH_ARROW_2))