コード例 #1
0
    def __init__(self):
        """ Constructor function """
        # Call the parent's constructor
        pygame.sprite.Sprite.__init__(self)
        sprite_sheet = spritesheet_functions.SpriteSheet("p_walk_sheet.png")
        # Load all the right facing images into a list
        image = sprite_sheet.get_image(0, 0, 75, 200)
        self.walking_frames_r.append(image)
        image = sprite_sheet.get_image(75, 0, 75, 200)
        self.walking_frames_r.append(image)
        image = sprite_sheet.get_image(150, 0, 75, 200)
        self.walking_frames_r.append(image)
        image = sprite_sheet.get_image(225, 0, 75, 200)
        self.walking_frames_r.append(image)
        image = sprite_sheet.get_image(300, 0, 75, 200)
        self.walking_frames_r.append(image)
        image = sprite_sheet.get_image(375, 0, 75, 200)
        self.walking_frames_r.append(image)
        image = sprite_sheet.get_image(450, 0, 75, 200)
        self.walking_frames_r.append(image)
        image = sprite_sheet.get_image(525, 0, 75, 200)
        self.walking_frames_r.append(image)
        image = sprite_sheet.get_image(600, 0, 75, 200)
        self.walking_frames_r.append(image)

        # Load all the right facing images, then flip them
        # to face left.
        image = sprite_sheet.get_image(0, 0, 75, 200)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = sprite_sheet.get_image(75, 0, 75, 200)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = sprite_sheet.get_image(150, 0, 75, 200)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = sprite_sheet.get_image(225, 0, 75, 200)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = sprite_sheet.get_image(300, 0, 75, 200)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = sprite_sheet.get_image(375, 0, 75, 200)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = sprite_sheet.get_image(450, 0, 75, 200)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = sprite_sheet.get_image(525, 0, 75, 200)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = sprite_sheet.get_image(600, 0, 75, 200)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)

        # Set the image the player starts with
        self.image = self.walking_frames_r[0]

        # Set a referance to the image rect.
        self.rect = self.image.get_rect()
コード例 #2
0
def player_hud(screen, player_health, player_stamina, estus_rn):
    player_maxhealth = 100
    player_maxstamina = 50
    estus_n = constants.estus_BF.render(str(estus_rn), True, constants.WHITE,
                                        None)
    estus_n_rect = estus_n.get_rect()
    estus_n_rect.x = 37
    estus_n_rect.y = 30
    image = spritesheet_functions.SpriteSheet("images/link.png")

    if estus_rn > 0:
        image = image.get_image(219, 1074, 12, 15, constants.BLACK)
    else:
        image = image.get_image(169, 1074, 12, 15, constants.BLACK)

    image = pygame.transform.scale(image, (25, 31))
    screen.blit(image, [10, 10])
    screen.blit(estus_n, estus_n_rect)

    pygame.draw.rect(screen, constants.WHITE,
                     (49, 14, (3 * player_maxhealth) + 2, 12))
    pygame.draw.rect(screen, constants.GRAY,
                     (50, 15, 3 * player_maxhealth, 10))
    if player_health > 0:
        pygame.draw.rect(screen, constants.RED,
                         (50, 15, 3 * player_health, 10))
    pygame.draw.rect(screen, constants.WHITE,
                     (49, 29, (3 * player_maxstamina) + 2, 12))
    pygame.draw.rect(screen, constants.GRAY,
                     (50, 30, 3 * player_maxstamina, 10))
    if player_stamina > 0:
        pygame.draw.rect(screen, constants.GREEN,
                         (50, 30, 3 * player_stamina, 10))
コード例 #3
0
    def __init__(self, sprite_sheet_data):
        """ Platform constructor. Assumes constructed with user passing in
            an array of 5 numbers like what's defined at the top of this
            code. """
        pygame.sprite.Sprite.__init__(self)

        sprite_sheet = spritesheet_functions.SpriteSheet("tile_sheet.png")
        # Grab the image for this platform
        self.image = sprite_sheet.get_image(sprite_sheet_data[0],
                                            sprite_sheet_data[1],
                                            sprite_sheet_data[2],
                                            sprite_sheet_data[3])

        self.rect = self.image.get_rect()
コード例 #4
0
    def __init__(self):

        super().__init__()

        self.maxhealth = 100
        self.health = 100
        self.maxstamina = 50
        self.stamina = 50
        self.estus_rn = 5
        self.defending = False

        # Define o vetor velocidade do player
        self.change_x = 0
        self.change_y = 0

        # Armazena todas as imagens da animação de descanço esquerda/direita do player
        self.waiting_frames_l = []
        self.waiting_frames_r = []

        # Armazena todas as imagens da animação de andar para esquerda/direita do player
        self.walking_frames_l = []
        self.walking_frames_r = []

        # Armazena todas as imagens da animação de pular para a esquerda/direita do player
        self.jumping_frames_l = []
        self.jumping_frames_r = []

        # Armazena todas as imagens da animação de defesa para a esquerda/direita
        self.defense_frames_l = []
        self.defense_frames_r = []

        # Armazena todas as imagens da animação de quebra de guarda para a esquerda/direita
        self.guardbreak_frames_l = []
        self.guardbreak_frames_r = []

        # Armazena todas as imagens da animação de parry para a esquerda/direita
        self.parry_frames_l = []
        self.parry_frames_r = []

        # Armazena todas as imagens da animação de ataque leve para a esquerda/direita
        self.lightatk_frames_l = []
        self.lightatk_frames_r = []

        # Direção que o player está virado
        self.direction = "R"

        # Lista de sprites que o player pode esbarrar
        self.level = None

        self.delay = self.i = self.s = 0
        sprite_sheet = spritesheet_functions.SpriteSheet("images/link.png")

        # Carrega todas as sprites paradas viradas para a direita numa lista
        list1 = [[54, 61, 42, 42], [54, 61, 42, 42], [54, 61, 42, 42],
                 [54, 61, 42, 42], [54, 61, 42, 42], [54, 61, 42, 42],
                 [54, 61, 42, 42], [54, 61, 42, 42], [54, 61, 42, 42],
                 [54, 61, 42, 42], [54, 61, 42, 42], [54, 61, 42, 42],
                 [54, 61, 42, 42], [54, 61, 42, 42], [54, 61, 42, 42],
                 [54, 61, 42, 42], [54, 61, 42, 42], [54, 61, 42, 42],
                 [54, 61, 42, 42], [54, 61, 42, 42], [54, 61, 42, 42],
                 [54, 61, 42, 42], [54, 61, 42, 42], [104, 61, 42, 42],
                 [154, 61, 42, 42], [104, 61, 42, 42]]

        self.waiting_frames_r = spritesheet_functions.createSprite(
            sprite_sheet, list1, 0, 1, constants.BLACK)
        # Vira as imagens para a esquerda
        self.waiting_frames_l = spritesheet_functions.createSprite(
            sprite_sheet, list1, 1, 1, constants.BLACK)

        # Carrega todas as sprites correndo viradas para a direita numa lista
        list1 = [[204, 411, 42, 41], [154, 411, 42, 41], [104, 411, 42, 41],
                 [54, 411, 42, 41], [4, 411, 42, 41], [204, 461, 42, 41],
                 [154, 461, 42, 41], [104, 461, 42, 41], [54, 461, 42, 41],
                 [4, 461, 42, 41]]

        self.walking_frames_r = spritesheet_functions.createSprite(
            sprite_sheet, list1, 0, 1, constants.BLACK)

        # Carrega todas as imagens correndo viradas para a direita e as vira para a esquerda
        list1 = [[4, 411, 42, 41], [54, 411, 42, 41], [104, 411, 42, 41],
                 [154, 411, 42, 41], [204, 411, 42, 41], [4, 461, 42, 41],
                 [54, 461, 42, 41], [104, 461, 42, 41], [154, 461, 42, 41],
                 [204, 461, 42, 41]]

        self.walking_frames_l = spritesheet_functions.createSprite(
            sprite_sheet, list1, 1, 1, constants.BLACK)

        # Carrega todas as imagens pulando viradas para a direita numa lista
        list1 = [[304, 0, 42, 54], [354, 0, 42, 54], [404, 0, 42, 54]]

        self.jumping_frames_r = spritesheet_functions.createSprite(
            sprite_sheet, list1, 0, 1, constants.BLACK)
        # Vira as imagens para a esquerda
        self.jumping_frames_l = spritesheet_functions.createSprite(
            sprite_sheet, list1, 1, 1, constants.BLACK)

        # Carrega todas as imagens de defesa viradas para a direita numa lista
        list1 = [[259, 311, 32, 42]]

        self.defense_frames_r = spritesheet_functions.createSprite(
            sprite_sheet, list1, 0, 1, constants.BLACK)
        # Vira as imagens para a esquerda
        self.defense_frames_l = spritesheet_functions.createSprite(
            sprite_sheet, list1, 1, 1, constants.BLACK)

        # Carrega todas as imagens de quebra de guarda viradas para a direita numa lista
        list1 = [[255, 562, 39, 44]]

        self.guardbreak_frames_r = spritesheet_functions.createSprite(
            sprite_sheet, list1, 0, 1, constants.BLACK)
        # vira as imagens para a esquerda
        self.guardbreak_frames_l = spritesheet_functions.createSprite(
            sprite_sheet, list1, 1, 1, constants.BLACK)

        # Carrega todas as imagens de parry viradas para a direita numa lista
        list1 = [[258, 363, 63, 38], [106, 757, 37, 49]]

        self.parry_frames_r = spritesheet_functions.createSprite(
            sprite_sheet, list1, 0, 1, constants.BLACK)
        # Vira as imagens para a esquerda
        self.parry_frames_l = spritesheet_functions.createSprite(
            sprite_sheet, list1, 1, 1, constants.BLACK)

        # Carrega todas as imagens de ataque leve viradas para a direita numa lista
        list1 = [[204, 59, 41, 45], [328, 313, 63, 38]]

        self.lightatk_frames_r = spritesheet_functions.createSprite(
            sprite_sheet, list1, 0, 1, constants.BLACK)
        # Vira as imagens para a esquerda
        self.lightatk_frames_l = spritesheet_functions.createSprite(
            sprite_sheet, list1, 1, 1, constants.BLACK)

        # Define a sprite que o player começa
        self.image = self.waiting_frames_r[0]

        # Define uma referência para o retângulo da sprite
        self.rect = self.image.get_rect()
コード例 #5
0
    def __init__(self):
 
        super().__init__()
 
        # Define o vetor velocidade do player
        self.change_x = 0
        self.change_y = 0
        
        # Armazena todas as imagens da animação de descanço esquerda/direita do player
        self.waiting_frames_l = []
        self.waiting_frames_r = []
        
        # Armazena todas as imagens da animação de andar para esquerda/direita do player
        self.walking_frames_l = []
        self.walking_frames_r = []
        
        # Armazena todas as imagens da animação de pular para a esquerda/direita do player
        self.jumping_frames_l = []
        self.jumping_frames_r = []
 
        # Direção que o player está virado
        self.direction = "L"
 
        # Lista de sprites que o player pode esbarrar
        self.level = None
 
        sprite_sheet = spritesheet_functions.SpriteSheet("images/ganon1.png")
        
        # Carrega todas as sprites paradas viradas para a direita
        list1 = [[11, 890, 48, 62],
                 [65, 890, 48, 62],
                 [121, 890, 48, 62],
                 [178, 890, 48, 62]]        
        
        self.waiting_frames_r = spritesheet_functions.createSprite(sprite_sheet,list1, 0, 1, constants.DARKBLUE)
        
        # Carrega todas as sprites paradas viradas para a direita e as vira para a esquerda
        list1 = [[178, 890, 48, 62],
                 [121, 890, 48, 62],
                 [65, 890, 48, 62],
                 [11, 890, 48, 62]]        
        
        self.waiting_frames_l = spritesheet_functions.createSprite(sprite_sheet,list1, 1, 1, constants.DARKBLUE)        
        
        # Carrega todas as sprites correndo viradas para a direita numa lista
        list1 = [[10, 976, 52, 57],
                 [71, 976, 52, 57],
                 [128, 976, 52, 57],
                 [181, 976, 52, 57],
                 [238, 976, 52, 57],
                 [300, 976, 52, 57],
                 [356, 976, 52, 57],
                 [410, 976, 52, 57]]
                 
        self.walking_frames_r = spritesheet_functions.createSprite(sprite_sheet,list1, 0, 1, constants.DARKBLUE)
 
        # Carrega todas as imagens correndo viradas para a direita e as vira para a esquerda
        list1 = [[410, 976, 52, 57],
                 [356, 976, 52, 57],
                 [300, 976, 52, 57],
                 [238, 976, 52, 57],
                 [181, 976, 52, 57],
                 [128, 976, 52, 57],
                 [71, 976, 52, 57],
                 [10, 976, 52, 57]]
                 
        self.walking_frames_l = spritesheet_functions.createSprite(sprite_sheet,list1, 1, 1, constants.DARKBLUE)
        
        # Carrega todas as imagens pulando viradas para a direita numa lista
        list1 = [[15, 1064, 41, 52],
                 [64, 1047, 41, 70],
                 [108, 1047, 41, 70]]
                 
        self.jumping_frames_r = spritesheet_functions.createSprite(sprite_sheet,list1, 0, 1, constants.DARKBLUE)
        
        # Carrega todas as imagens pulando viradas para a direita e as vira para a esquerda
        list1 = [[15, 1064, 41, 52],
                 [64, 1047, 41, 70],
                 [108, 1047, 41, 70]]
                 
        self.jumping_frames_l = spritesheet_functions.createSprite(sprite_sheet,list1, 1, 1, constants.DARKBLUE)        
 
        # Define a sprite que o player começa
        self.image = self.waiting_frames_r[0]
 
        # Define uma referência para o retângulo da sprite
        self.rect = self.image.get_rect()
コード例 #6
0
    def __init__(self):
        """ Constructor function """
        # Call the parent's constructor
        super().__init__()

        constants.Hp_Max = 100
        self.hp = constants.Hp = constants.Hp_Max
        constants.Mp_Max = 50
        self.mp = constants.Mp = constants.Mp_Max
        self.Atk = constants.Atk = 20
        self.Def = constants.Def = 10

        #Carrega a Spritesheet:
        sprite_sheet = spritesheet_functions.SpriteSheet("Fotos\MrSatan.PNG")
        #Face do personagem:
        self.Face = sprite_sheet.get_image(1378, 348, 174, 227, 0)
        self.Face = pygame.transform.scale(self.Face, (58, 67))
        #Sprites Para Personagem Parado:
        self.Para_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[4, 155, 72, 110, 0], [82, 155, 72, 110, 0],
                           [159, 155, 72, 111, 0]])
        self.Para_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[4, 155, 72, 110, 0], [82, 155, 72, 110, 0],
                           [159, 155, 72, 111, 0]], 1)
        """Movimentos:"""
        #Sprites para Personagem Andando:
        self.Move_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[338, 155, 66, 110, 0], [414, 155, 64, 110, 0],
                           [482, 155, 64, 110, 0], [552, 155, 64, 110, 0],
                           [623, 155, 64, 110, 0]])
        self.Move_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[338, 155, 66, 110, 0], [414, 155, 64, 110, 0],
                           [482, 155, 64, 110, 0], [552, 155, 64, 110, 0],
                           [623, 155, 64, 110, 0]], 1)
        #Sprites para Salto Parado
        self.Salto_Para_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[90, 520, 70, 110, 0], [170, 511, 66, 119, 0],
                           [249, 517, 64, 113, 0], [321, 525, 64, 103, 0],
                           [392, 520, 70, 110, 0]])
        self.Salto_Para_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[90, 520, 70, 110, 0], [170, 511, 66, 119, 0],
                           [249, 517, 64, 113, 0], [321, 525, 64, 103, 0],
                           [392, 520, 70, 110, 0]], 1)
        #Sprites Para Salto em Movimento:
        self.Salto_Move_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[90, 676, 70, 110, 0], [171, 689, 80, 97, 0],
                           [362, 673, 64, 113, 0], [432, 676, 61, 110, 0],
                           [502, 676, 69, 110, 0]])
        self.Salto_Move_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[90, 676, 70, 110, 0], [171, 689, 80, 97, 0],
                           [362, 673, 64, 113, 0], [432, 676, 61, 110, 0],
                           [502, 676, 69, 110, 0]], 1)
        # Defesa:
        self.Def_R = spritesheet_functions.createSprite(
            sprite_sheet, [[16, 971, 72, 103, 0], [93, 971, 61, 103, 0]])
        self.Def_L = spritesheet_functions.createSprite(
            sprite_sheet, [[16, 971, 72, 103, 0], [93, 971, 61, 103, 0]], 1)
        #Recebe Dano:
        self.Dmg_R = spritesheet_functions.createSprite(
            sprite_sheet, [[184, 1098, 71, 110, 0], [261, 1098, 81, 110, 0]])
        self.Dmg_L = spritesheet_functions.createSprite(
            sprite_sheet, [[184, 1098, 71, 110, 0], [261, 1098, 81, 110, 0]],
            1)
        #Morte:
        self.Dead_R = spritesheet_functions.createSprite(
            sprite_sheet, [[12, 1239, 115, 110, 0], [137, 1239, 115, 110, 0],
                           [266, 1239, 112, 110, 0], [385, 1239, 119, 110, 0],
                           [510, 1239, 118, 110, 0]])
        self.Dead_L = spritesheet_functions.createSprite(
            sprite_sheet, [[12, 1239, 115, 110, 0], [137, 1239, 115, 110, 0],
                           [266, 1239, 112, 110, 0], [385, 1239, 119, 110, 0],
                           [510, 1239, 118, 110, 0]], 1)
        """Golpes:"""
        #ATAQUE BASICO:
        self.Atk_P1_R = spritesheet_functions.createSprite(
            sprite_sheet, [[8, 1933, 70, 110, 0], [85, 1933, 72, 110, 0],
                           [162, 1933, 99, 110, 0], [162, 1933, 99, 110, 0]])
        self.Atk_P2_R = spritesheet_functions.createSprite(
            sprite_sheet, [[286, 1933, 72, 110, 0], [362, 1933, 72, 110, 0],
                           [438, 1933, 98, 110, 0], [438, 1933, 98, 110, 0]])
        self.Atk_P1_L = spritesheet_functions.createSprite(
            sprite_sheet, [[8, 1933, 70, 110, 0], [85, 1933, 72, 110, 0],
                           [162, 1933, 99, 110, 0], [162, 1933, 99, 110, 0]],
            1)
        self.Atk_P2_L = spritesheet_functions.createSprite(
            sprite_sheet, [[286, 1933, 72, 110, 0], [362, 1933, 72, 110, 0],
                           [438, 1933, 98, 110, 0], [438, 1933, 98, 110, 0]],
            1)
        #Chutes:
        self.Atk_K1_R = spritesheet_functions.createSprite(
            sprite_sheet, [[276, 2067, 73, 110, 0], [362, 2067, 63, 110, 0],
                           [431, 2067, 97, 110, 0], [431, 2067, 97, 110, 0],
                           [431, 2067, 97, 110, 0]])
        self.Atk_K1_L = spritesheet_functions.createSprite(
            sprite_sheet, [[276, 2067, 73, 110, 0], [362, 2067, 63, 110, 0],
                           [431, 2067, 97, 110, 0], [431, 2067, 97, 110, 0],
                           [431, 2067, 97, 110, 0]], 1)
        #Comemoraçao
        self.Com_R = spritesheet_functions.createSprite(
            sprite_sheet, [[6, 37, 51, 116, 0], [65, 37, 66, 116, 0],
                           [141, 37, 86, 116, 0], [233, 37, 82, 116, 0],
                           [326, 37, 82, 116, 0], [419, 37, 83, 116, 0],
                           [511, 37, 66, 116, 0], [587, 37, 51, 116, 0]])

        # Set the image the player starts with
        self.image = self.Para_Frames_R[0]
        # Set a reference to the image rect.

        self.rect = self.image.get_rect()
コード例 #7
0
    def __init__(self):
        """ Constructor function """
        # Call the parent's constructor
        super().__init__()

        self.Hp_Max = 100
        self.hp = self.Hp_Max
        self.Mp_Max = 50
        self.mp = self.Mp_Max
        self.Atk = 20
        self.Def = 10

        #Carrega a Spritesheet:
        sprite_sheet = spritesheet_functions.SpriteSheet(
            "Fotos\SB2_CellJr.PNG")
        #Sprites Para Personagem Parado:
        self.Para_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[5, 5, 38, 49, 0], [47, 5, 39, 49, 0]])
        self.Para_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[5, 5, 38, 49, 0], [47, 5, 39, 49, 0]], 1)
        """Movimentos:"""
        #Sprites para Personagem Andando:
        self.Move_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[5, 58, 38, 49, 0], [47, 58, 39, 49, 0],
                           [90, 58, 38, 49, 0], [132, 58, 38, 49, 0]])
        self.Move_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[5, 58, 38, 49, 0], [47, 58, 39, 49, 0],
                           [90, 58, 38, 49, 0], [132, 58, 38, 49, 0]], 1)
        #Sprites para Salto Parado
        self.Salto_Para_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet,
            [[5, 118, 38, 49, 0], [121, 111, 39, 56, 0], [164, 111, 42, 42, 0],
             [210, 111, 36, 56, 0], [5, 118, 38, 49, 0]])
        self.Salto_Para_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet,
            [[5, 118, 38, 49, 0], [121, 111, 39, 56, 0], [164, 111, 42, 42, 0],
             [210, 111, 36, 56, 0], [5, 118, 38, 49, 0]], 1)
        #Sprites Para Salto em Movimento:
        #        self.Salto_Move_Frames_R = spritesheet_functions.createSprite(sprite_sheet,[[17,448,65,108,0],[91,448,77,108,0],[176,448,85,108,0],[270,448,77,108,0],[355,589,65,108,0]])
        #        self.Salto_Move_Frames_L = spritesheet_functions.createSprite(sprite_sheet,[[17,448,65,108,0],[91,448,77,108,0],[176,448,85,108,0],[270,448,77,108,0],[355,589,65,108,0]],1)
        #Recebe Dano:
        self.Dmg_R = spritesheet_functions.createSprite(
            sprite_sheet, [[43, 984, 42, 50, 0]])
        self.Dmg_L = spritesheet_functions.createSprite(
            sprite_sheet, [[43, 984, 42, 50, 0]], 1)
        #Morte:
        self.Dead_R = spritesheet_functions.createSprite(
            sprite_sheet, [[5, 1038, 38, 45, 0], [47, 1034, 42, 49, 0],
                           [93, 1034, 43, 49, 0], [140, 1034, 42, 49, 0],
                           [186, 1034, 51, 49, 0]])
        self.Dead_L = spritesheet_functions.createSprite(
            sprite_sheet, [[5, 1038, 38, 45, 0], [47, 1034, 42, 49, 0],
                           [93, 1034, 43, 49, 0], [140, 1034, 42, 49, 0],
                           [186, 1034, 51, 49, 0]], 1)
        """Golpes:"""
        #ATAQUE BASICO:
        self.Atk_P1_R = spritesheet_functions.createSprite(
            sprite_sheet, [[189, 386, 41, 48, 0], [234, 386, 47, 48, 0],
                           [234, 386, 47, 48, 0]])
        self.Atk_P2_R = spritesheet_functions.createSprite(
            sprite_sheet, [[284, 386, 43, 48, 0], [332, 386, 46, 48, 0],
                           [332, 386, 46, 48, 0]])
        self.Atk_P1_L = spritesheet_functions.createSprite(
            sprite_sheet, [[189, 386, 41, 48, 0], [234, 386, 47, 48, 0],
                           [234, 386, 47, 48, 0]], 1)
        self.Atk_P2_L = spritesheet_functions.createSprite(
            sprite_sheet, [[284, 386, 43, 48, 0], [332, 386, 46, 48, 0],
                           [332, 386, 46, 48, 0]], 1)
        #Chutes:
        self.Atk_K1_R = spritesheet_functions.createSprite(
            sprite_sheet, [[5, 275, 34, 52, 0], [43, 275, 47, 52, 0],
                           [43, 275, 47, 52, 0], [94, 275, 34, 52, 0]])
        self.Atk_K1_L = spritesheet_functions.createSprite(
            sprite_sheet, [[5, 275, 34, 52, 0], [43, 275, 47, 52, 0],
                           [43, 275, 47, 52, 0], [94, 275, 34, 52, 0]], 1)
        """Define a imagem inicial"""
        self.image = self.Para_Frames_R[0]
        # Set a reference to the image rect.

        self.rect = self.image.get_rect()
コード例 #8
0
    def __init__(self):
        """ Constructor function """
        # Call the parent's constructor
        super().__init__()

        self.Hp_Max = 100
        self.hp = self.Hp_Max
        self.Mp_Max = 50
        self.mp = self.Mp_Max
        self.Atk = 20
        self.Def = 10
        self.nome = "Cell"

        #Carrega a Spritesheet:
        sprite_sheet = spritesheet_functions.SpriteSheet("Fotos\CellHD.PNG")
        #Sprites Para Personagem Parado:
        self.Para_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 35, 44, 108, 0], [71, 35, 44, 108, 0],
                           [125, 35, 44, 108, 0], [179, 35, 44, 108, 0]])
        self.Para_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 35, 44, 108, 0], [71, 35, 44, 108, 0],
                           [125, 35, 44, 108, 0], [179, 35, 44, 108, 0]], 1)
        """Movimentos:"""
        #Sprites para Personagem Andando:
        self.Move_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 180, 49, 108, 0], [76, 180, 44, 108, 0],
                           [130, 180, 45, 108, 0], [185, 180, 45, 108, 0]])
        self.Move_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 180, 49, 108, 0], [76, 180, 44, 108, 0],
                           [130, 180, 45, 108, 0], [185, 180, 45, 108, 0]], 1)
        #Sprites para Salto Parado
        self.Salto_Para_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 589, 65, 108, 0], [91, 589, 77, 108, 0],
                           [176, 589, 85, 108, 0], [270, 589, 77, 108, 0],
                           [355, 589, 65, 108, 0]])
        self.Salto_Para_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 589, 65, 108, 0], [91, 589, 77, 108, 0],
                           [176, 589, 85, 108, 0], [270, 589, 77, 108, 0],
                           [355, 589, 65, 108, 0]], 1)
        #Sprites Para Salto em Movimento:
        self.Salto_Move_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 448, 65, 108, 0], [91, 448, 77, 108, 0],
                           [176, 448, 85, 108, 0], [270, 448, 77, 108, 0],
                           [355, 589, 65, 108, 0]])
        self.Salto_Move_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 448, 65, 108, 0], [91, 448, 77, 108, 0],
                           [176, 448, 85, 108, 0], [270, 448, 77, 108, 0],
                           [355, 589, 65, 108, 0]], 1)
        #Recebe Dano:
        self.Dmg_R = spritesheet_functions.createSprite(
            sprite_sheet, [[285, 3496, 50, 108, 0]])
        self.Dmg_L = spritesheet_functions.createSprite(
            sprite_sheet, [[285, 3496, 50, 108, 0]], 1)
        #Morte:
        self.Dead_R = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 3631, 55, 108, 0], [81, 3631, 80, 108, 0],
                           [17, 3631, 55, 108, 0], [170, 3631, 109, 108, 0],
                           [287, 3631, 104, 108, 0]])
        self.Dead_L = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 3631, 55, 108, 0], [81, 3631, 80, 108, 0],
                           [17, 3631, 55, 108, 0], [170, 3631, 109, 108, 0],
                           [287, 3631, 104, 108, 0]], 1)
        """Golpes:"""
        #ATAQUE BASICO:
        self.Atk_P1_R = spritesheet_functions.createSprite(
            sprite_sheet, [[775, 731, 75, 108, 0], [839, 731, 78, 108, 0],
                           [927, 731, 66, 108, 0]])
        self.Atk_P2_R = spritesheet_functions.createSprite(
            sprite_sheet, [[775, 731, 75, 108, 0], [839, 731, 78, 108, 0],
                           [927, 731, 66, 108, 0]])
        self.Atk_P1_L = spritesheet_functions.createSprite(
            sprite_sheet, [[775, 731, 75, 108, 0], [839, 731, 78, 108, 0],
                           [927, 731, 66, 108, 0]], 1)
        self.Atk_P2_L = spritesheet_functions.createSprite(
            sprite_sheet, [[775, 731, 75, 108, 0], [839, 731, 78, 108, 0],
                           [927, 731, 66, 108, 0]], 1)
        #Chutes:
        self.Atk_K1_R = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 731, 65, 108, 0], [91, 731, 76, 108, 0],
                           [176, 731, 99, 108, 0], [285, 731, 76, 108, 0],
                           [369, 731, 65, 108, 0]])
        self.Atk_K1_L = spritesheet_functions.createSprite(
            sprite_sheet, [[17, 731, 65, 108, 0], [91, 731, 76, 108, 0],
                           [176, 731, 99, 108, 0], [285, 731, 76, 108, 0],
                           [369, 731, 65, 108, 0]], 1)
        """Define a imagem inicial"""
        self.image = self.Para_Frames_R[0]
        # Set a reference to the image rect.

        self.rect = self.image.get_rect()
コード例 #9
0
    def __init__(self):
        """ Constructor function """
        # Call the parent's constructor
        super().__init__()

        self.Hp_Max = 100
        self.hp = self.Hp_Max
        self.Mp_Max = 50
        self.mp = self.Mp_Max
        self.Atk = 20
        self.Def = 10

        #Carrega a Spritesheet:
        sprite_sheet = spritesheet_functions.SpriteSheet("Fotos\MrSatan.PNG")
        #Sprites Para Personagem Parado:
        self.Para_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[4, 155, 72, 110, 0], [82, 155, 72, 110, 0],
                           [159, 155, 72, 111, 0]])
        self.Para_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[4, 155, 72, 110, 0], [82, 155, 72, 110, 0],
                           [159, 155, 72, 111, 0]], 1)
        """Movimentos:"""
        #Sprites para Personagem Andando:
        self.Move_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[338, 155, 66, 110, 0], [414, 155, 64, 110, 0],
                           [482, 155, 64, 110, 0], [552, 155, 64, 110, 0],
                           [623, 155, 64, 110, 0]])
        self.Move_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[338, 155, 66, 110, 0], [414, 155, 64, 110, 0],
                           [482, 155, 64, 110, 0], [552, 155, 64, 110, 0],
                           [623, 155, 64, 110, 0]], 1)
        #Sprites para Salto Parado
        self.Salto_Para_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[90, 520, 70, 110, 0], [170, 511, 66, 119, 0],
                           [249, 517, 64, 113, 0], [321, 525, 64, 103, 0],
                           [392, 520, 70, 110, 0]])
        self.Salto_Para_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[90, 520, 70, 110, 0], [170, 511, 66, 119, 0],
                           [249, 517, 64, 113, 0], [321, 525, 64, 103, 0],
                           [392, 520, 70, 110, 0]], 1)
        #Sprites Para Salto em Movimento:
        self.Salto_Move_Frames_R = spritesheet_functions.createSprite(
            sprite_sheet, [[90, 676, 70, 110, 0], [171, 689, 80, 97, 0],
                           [362, 673, 64, 113, 0], [432, 676, 61, 110, 0],
                           [502, 676, 69, 110, 0]])
        self.Salto_Move_Frames_L = spritesheet_functions.createSprite(
            sprite_sheet, [[90, 676, 70, 110, 0], [171, 689, 80, 97, 0],
                           [362, 673, 64, 113, 0], [432, 676, 61, 110, 0],
                           [502, 676, 69, 110, 0]], 1)
        #Recebe Dano:
        self.Dmg_R = spritesheet_functions.createSprite(
            sprite_sheet, [[184, 1098, 71, 110, 0], [261, 1098, 81, 110, 0]])
        self.Dmg_L = spritesheet_functions.createSprite(
            sprite_sheet, [[184, 1098, 71, 110, 0], [261, 1098, 81, 110, 0]],
            1)
        #Morte:
        self.Dead_R = spritesheet_functions.createSprite(
            sprite_sheet, [[12, 1239, 115, 110, 0], [137, 1239, 115, 110, 0],
                           [266, 1239, 112, 110, 0], [385, 1239, 119, 110, 0],
                           [510, 1239, 118, 110, 0]])
        self.Dead_L = spritesheet_functions.createSprite(
            sprite_sheet, [[12, 1239, 115, 110, 0], [137, 1239, 115, 110, 0],
                           [266, 1239, 112, 110, 0], [385, 1239, 119, 110, 0],
                           [510, 1239, 118, 110, 0]], 1)
        """Golpes:"""
        #ATAQUE BASICO:
        self.Atk_P1_R = spritesheet_functions.createSprite(
            sprite_sheet, [[8, 1933, 70, 110, 0], [85, 1933, 72, 110, 0],
                           [162, 1933, 99, 110, 0]])
        self.Atk_P2_R = spritesheet_functions.createSprite(
            sprite_sheet, [[286, 1933, 72, 110, 0], [362, 1933, 72, 110, 0],
                           [438, 1933, 98, 110, 0]])
        self.Atk_P1_L = spritesheet_functions.createSprite(
            sprite_sheet, [[8, 1933, 70, 110, 0], [85, 1933, 72, 110, 0],
                           [162, 1933, 99, 110, 0]], 1)
        self.Atk_P2_L = spritesheet_functions.createSprite(
            sprite_sheet, [[286, 1933, 72, 110, 0], [362, 1933, 72, 110, 0],
                           [438, 1933, 98, 110, 0]], 1)
        #Chutes:
        self.Atk_K1_R = spritesheet_functions.createSprite(
            sprite_sheet, [[276, 2067, 73, 110, 0], [362, 2067, 63, 110, 0],
                           [431, 2067, 97, 110, 0]])
        self.Atk_K1_L = spritesheet_functions.createSprite(
            sprite_sheet, [[276, 2067, 73, 110, 0], [362, 2067, 63, 110, 0],
                           [431, 2067, 97, 110, 0]], 1)
        """Define a imagem inicial"""
        self.image = self.Para_Frames_R[0]
        # Set a reference to the image rect.

        self.rect = self.image.get_rect()