Ejemplo n.º 1
0
    def load_sprite(self):
        super().load_sprite()

        self.animations = {}

        self.animations[ActorBomb.State.DETONATE] = Animation(
            load_image("assets/bibomb.png", False), Rect(0, 0, 41, 48), 2, 800)
        self.animations[ActorBomb.State.EXPLODE] = Animation(
            load_image("assets/explosion.png", False),
            pygame.Rect(0, 0, 192, 192), 5, 25, False, False, 5,
            self.destroyed)
Ejemplo n.º 2
0
    def load_sprite(self):
        self.animations = {}
        self.animations[ActorArrowChargedPlayer.State.TRAVEL] = Animation(
            load_image("assets/bullet_charged.png", False), Rect(0, 0, 48, 48),
            1, -1, True)
        self.animations[ActorArrowChargedPlayer.State.EXPLODE] = Animation(
            load_image("assets/bullet_charged_explosion.png", False),
            Rect(0, 0, 192, 192),
            5,
            100,
            callback_fun=self.bye)

        self._state = ActorArrowChargedPlayer.State.TRAVEL
Ejemplo n.º 3
0
    def load_sprite(self):
        super().load_sprite()

        sprite_sheet = load_image(type(self).FILE, False)
        width = type(self).WIDTH
        height = type(self).HEIGHT

        self.animations = {}
        self.animations[ActorSlime.State.IDLE] = Animation(
            sprite_sheet, pygame.Rect(0, 0, width, height), 9, 50, True)
        self.animations[ActorSlime.State.MOVE] = Animation(
            sprite_sheet, pygame.Rect(0, height, width, height), 9, 100, True)
        self.animations[ActorSlime.State.JUMP] = Animation(
            sprite_sheet, pygame.Rect(0, height * 2, width, height), 9, 50,
            True)
        self.animations[ActorSlime.State.ATTACK] = Animation(
            sprite_sheet,
            pygame.Rect(0, height * 3, width, height),
            9,
            50,
            True,
            callback_fun=self.idle)
        self.animations[ActorSlime.State.DIE] = Animation(
            sprite_sheet,
            pygame.Rect(0, height * 4, width, height),
            9,
            50,
            True,
            callback_fun=self.dead)
Ejemplo n.º 4
0
    def load_sprite(self):
        super().load_sprite()

        try:
            self.sprite = load_image("assets/" + self.path, False)
        except:
            self.info("C'est normal, mon programme est puant !")
Ejemplo n.º 5
0
    def load_sprite(self):
        super().load_sprite()

        sprite = load_image(self.path, False).subsurface(
            (self.pos.x, self.pos.y), (self.width, self.height))
        rect = get_real_rect(sprite)
        sprite = sprite.subsurface(rect.pyrect)
        self.sprite = sprite
Ejemplo n.º 6
0
    def load_sprite(self):
        sprites_sheet = load_image("assets/marinka.png", False)
        self.animations = {}

        self.animations[DIRECTION.HAUT] = Animation(sprites_sheet, pygame.Rect(PLAYER_MOVE_TOP.x * PLAYER_SPRITE_WIDTH,
                                                                               PLAYER_MOVE_TOP.y * PLAYER_SPRITE_HEIGHT,
                                                                               PLAYER_SPRITE_WIDTH,
                                                                               PLAYER_SPRITE_HEIGHT),
                                                    PLAYER_MOVE_TILES_NUMBER, PLAYER_MOVE_TIME, auto_rect=True)
        self.animations[DIRECTION.GAUCHE] = Animation(sprites_sheet,
                                                      pygame.Rect(PLAYER_MOVE_LEFT.x * PLAYER_SPRITE_WIDTH,
                                                                  PLAYER_MOVE_LEFT.y * \
                                                                  PLAYER_SPRITE_HEIGHT, PLAYER_SPRITE_WIDTH,
                                                                  PLAYER_SPRITE_HEIGHT),
                                                      PLAYER_MOVE_TILES_NUMBER, PLAYER_MOVE_TIME, True)
        self.animations[DIRECTION.DROITE] = Animation(sprites_sheet,
                                                      pygame.Rect(PLAYER_MOVE_RIGHT.x * PLAYER_SPRITE_WIDTH,
                                                                  PLAYER_MOVE_RIGHT.y * \
                                                                  PLAYER_SPRITE_HEIGHT, PLAYER_SPRITE_WIDTH,
                                                                  PLAYER_SPRITE_HEIGHT),
                                                      PLAYER_MOVE_TILES_NUMBER, PLAYER_MOVE_TIME, True)
        self.animations[DIRECTION.BAS] = Animation(sprites_sheet,
                                                   pygame.Rect(PLAYER_MOVE_BOTTOM.x * PLAYER_SPRITE_WIDTH,
                                                               PLAYER_MOVE_BOTTOM.y * \
                                                               PLAYER_SPRITE_HEIGHT, PLAYER_SPRITE_WIDTH,
                                                               PLAYER_SPRITE_HEIGHT),
                                                   PLAYER_MOVE_TILES_NUMBER, PLAYER_MOVE_TIME, True)
        self.animations[DIRECTION.NONE] = Animation(sprites_sheet, pygame.Rect(PLAYER_STANDBY.x * PLAYER_SPRITE_WIDTH,
                                                                               PLAYER_STANDBY.y * \
                                                                               PLAYER_SPRITE_HEIGHT,
                                                                               PLAYER_SPRITE_WIDTH,
                                                                               PLAYER_SPRITE_HEIGHT), 1, 1000, True)

        self.animations[ActorPlayer.State.DYING] = Animation(sprites_sheet, pygame.Rect(PLAYER_DYING.x * PLAYER_SPRITE_WIDTH,
                                                                               PLAYER_DYING.y * \
                                                                               PLAYER_SPRITE_HEIGHT,
                                                                               PLAYER_SPRITE_WIDTH,
                                                                               PLAYER_SPRITE_HEIGHT),
                                                 PLAYER_DIE_TILES_NUMBER, PLAYER_DYING_TIME, True, callback_fun = self.dead)
        self.animations[ActorPlayer.State.DEAD] = Animation(sprites_sheet, pygame.Rect(5 * PLAYER_SPRITE_WIDTH,
                                                                               PLAYER_DYING.y * \
                                                                               PLAYER_SPRITE_HEIGHT,
                                                                               PLAYER_SPRITE_WIDTH,
                                                                               PLAYER_SPRITE_HEIGHT), 1, 0, True)
        self.animations[ActorPlayer.State.CHARGE] = Animation(sprites_sheet, Rect(0, 19 * PLAYER_SPRITE_HEIGHT,
                                                                                  PLAYER_SPRITE_WIDTH, PLAYER_SPRITE_HEIGHT),
                                                              9, 75, auto_rect=True, callback_fun=self.charge)
        self.animations[ActorPlayer.State.CHARGED] = Animation(sprites_sheet, Rect(8 * PLAYER_SPRITE_WIDTH, 19 * PLAYER_SPRITE_HEIGHT,
                                                                                  PLAYER_SPRITE_WIDTH, PLAYER_SPRITE_HEIGHT),
                                                              1, -50, True)

        self.rect = self.animations[DIRECTION.NONE].get_rect(self.rect)
Ejemplo n.º 7
0
    def load_sprite(self):  # Chargement des images de la porte
        super().load_sprite()

        self.sprites = {}

        self.sprites[False] = pygame.transform.flip(
            load_image_tile("assets/gates.png", pygame.Rect(0, 0, 96, 64),
                            True), False, False)
        self.sprites[True] = pygame.transform.flip(
            load_image_tile("assets/gates.png", pygame.Rect(0, 192, 96, 64),
                            True), False, False)
        self.sprite = self.sprites[self.is_open]

        self.animation = Animation(load_image("assets/gates.png"),
                                   pygame.Rect(0, 64, 96, 64),
                                   2,
                                   auto_rect=True,
                                   vertical=True)
Ejemplo n.º 8
0
 def load_sprite(self):
     self.sprite = load_image("assets/bullets.png",
                              False).subsurface(208, 67, 11, 11)
Ejemplo n.º 9
0
 def load_sprite(self):
     self.sprite = load_image("assets/bullet.png")
Ejemplo n.º 10
0
    def generate(self):
        """Génère l'image produite par les attributs choisis"""

        # On charge d'abord le 'body'
        self.generated_sprite = load_image(self.body_list[self.body_index],
                                           False)
        # On copie par dessus nos éléments
        # Ears
        self.generated_sprite.blit(
            load_image(self.ears_list[self.ears_index], False), (0, 0))
        # Eyes
        self.generated_sprite.blit(
            load_image(self.eyes_list[self.eyes_index], False), (0, 0))
        # Nose
        self.generated_sprite.blit(
            load_image(self.nose_list[self.nose_index], False), (0, 0))

        # Hair
        self.generated_sprite.blit(
            load_image(
                self.hair_color_list[self.hair_type_list[self.hair_type_index]]
                [self.hair_color_index], False), (0, 0))

        # Legs
        self.generated_sprite.blit(
            load_image(
                self.legs_color_list[self.legs_type_list[self.legs_type_index]]
                [self.legs_color_index], False), (0, 0))

        # Head
        self.generated_sprite.blit(
            load_image(
                self.head_color_list[self.head_type_list[self.head_type_index]]
                [self.head_color_index], False), (0, 0))

        # Torso
        self.generated_sprite.blit(
            load_image(
                self.torso_color_list[self.torso_type_list[
                    self.torso_type_index]][self.torso_color_index], False),
            (0, 0))

        # Hands
        self.generated_sprite.blit(
            load_image(
                self.hands_color_list[self.hands_type_list[
                    self.hands_type_index]][self.hands_color_index], False),
            (0, 0))

        # Feet
        self.generated_sprite.blit(
            load_image(
                self.feet_color_list[self.feet_type_list[self.feet_type_index]]
                [self.feet_color_index], False), (0, 0))

        self.sprite_to_draw = self.generated_sprite.subsurface(
            PLAYER_STANDBY.x * PLAYER_SPRITE_WIDTH,
            PLAYER_STANDBY.y * PLAYER_SPRITE_HEIGHT, PLAYER_SPRITE_WIDTH,
            PLAYER_SPRITE_HEIGHT)

        # Bow
        self.generated_sprite.blit(
            load_image(self.bow_list[self.bow_index], False), (0, 0))

        self.sprite_to_draw = pygame.transform.scale2x(self.sprite_to_draw)
Ejemplo n.º 11
0
    def load_sprite(self):
        super().load_sprite()

        self.sprite = load_image("assets/rock.png", True)
Ejemplo n.º 12
0
    def load_sprite(self):
        super().load_sprite()

        self.sprite = load_image(
            "assets/gui_bar.png")  #Pour faire un contour rÔse bien moche
Ejemplo n.º 13
0
    def load_sprite(self):
        super().load_sprite()

        self.sprite = load_image("assets/Wall1.png")