Exemplo n.º 1
0
 def __init__(self, initialAction, playerId, speed = 15):
     """Iniciation of the player states"""
     Characters.__init__(self,initialAction, speed = 15)
     self.pos = 1
     self.pos2 = 1
     self.movex, self.movey = 0,0
     self.facingRight = True
     self.x = 250
     self.y = 350
     self.Rect = Rect(self.x, self.y, 35, 70)
     self.HP = 400
     self.XP = 50
     self.XPMAX = 150
     self.Defending = False
     self.Attacking = False
     self.punchDamage = 0
     self.kickDamage = 0
     self.hitDefended = 0
     self.powerDamage = 0
     self.powerDamageDefended = 0
     self.initialTime = 0
     self.timing2 = True
     self.punchDamage = 2
     self.kickDamage = 2
     self.hitDefended = 0.4
     self.powerDamage = 10
     self.powerDamageDefended = 2
     self.comboDamage = 10
     self.playerId = playerId
     self.loading = False
     self.superPunchState = False
     self.superKickState = False
     self.factorSuper = 1.4
     #self.inicialTime
     self.initialTime1 = time.time()*1000
     self.initialTime2 = time.time()*1000
     self.initialTime3 = time.time()*1000
     self.initialTime4 = time.time()*1000
     self.initialTime5 = time.time()*1000
     self.initialTime6 = time.time()*1000
     self.initialTime7 = time.time()*1000
     self.initialSpark = time.time()*1000
     self.initialExplosion = time.time()*1000
     self.kamehamMs = 160
     self.punchMs = 90
     self.releasePower = True
     self.voidPower = True
     self.kameCont = 22
     self.enemykameCont = 0
     self.staticy = 0
     self.initialKame = time.time()*1000
     self.initialPunch = time.time()*1000
     self.initialEffects = time.time()*1000
     self.isPC = True
     self.singleKameham = True
     self.disputeKamehamBoolean = True
     self.teleportBoolean = True
Exemplo n.º 2
0
    def save_csv(data, title=None, path="csv_test.csv"):
        if not title:
            title = ["name", "age", "telephone"]
        csv_file = file(path, "wb")
        writer = csv.writer(csv_file)

        utf_title = Characters.unicode_to_concrete(title)
        writer.writerow(utf_title)
        utf_data = Characters.unicode_to_concrete(data)
        writer.writerow(utf_data)

        csv_file.close()
Exemplo n.º 3
0
 def __init__(self, initial_action, player_id):
     """Iniciation of the player states"""
     Characters.__init__(self, initial_action, player_id)
     self.pos = 1
     self.pos2 = 1
     self.movex, self.movey = 0, 0
     self.facing_right = True
     self.x = 250
     self.y = 350
     self.Rect = pygame.Rect(self.x, self.y, 35, 70)
     self.hp = 400
     self.xp = 50
     self.XP_MAX = 150
     self.defending = False
     self.attacking = False
     self.initialTime = 0
     self.timing2 = True
     self.punch_damage = 2
     self.hit_defended = 0.4
     self.power_damage = 10
     self.player_id = player_id
     self.loading = False
     self.super_punch_state = False
     self.super_kick_state = False
     self.factor_super = 1.4
     self.initial_time1 = time.time() * 1000
     self.initial_time2 = time.time() * 1000
     self.initial_time3 = time.time() * 1000
     self.initial_time4 = time.time() * 1000
     self.initial_time5 = time.time() * 1000
     self.initial_time6 = time.time() * 1000
     self.initial_time7 = time.time() * 1000
     self.initial_spark = time.time() * 1000
     self.initial_explosion = time.time() * 1000
     self.kameham_ms = 160
     self.punch_ms = 90
     self.staticy = 0
     self.initial_kame = time.time() * 1000
     self.initial_punch = time.time() * 1000
     self.initial_effects = time.time() * 1000
     self.is_pc = True
     self.single_kameham = True
     self.teleport_boolean = True
     self.kame_cont = 22
     self.attack_rect = None
     self.hp_rect = None
     self.xp_rect = None
     self.initial_death = 0
Exemplo n.º 4
0
 def __init__(self, initial_action, player_id):
     """Iniciation of the player states"""
     Characters.__init__(self, initial_action, player_id)
     self.pos = 1
     self.pos2 = 1
     self.movex, self.movey = 0, 0
     self.facing_right = True
     self.x = 250
     self.y = 350
     self.Rect = pygame.Rect(self.x, self.y, 35, 70)
     self.hp = 400
     self.xp = 50
     self.XP_MAX = 150
     self.defending = False
     self.attacking = False
     self.initialTime = 0
     self.timing2 = True
     self.punch_damage = 2
     self.hit_defended = 0.4
     self.power_damage = 10
     self.player_id = player_id
     self.loading = False
     self.super_punch_state = False
     self.super_kick_state = False
     self.factor_super = 1.4
     self.initial_time1 = time.time()*1000
     self.initial_time2 = time.time()*1000
     self.initial_time3 = time.time()*1000
     self.initial_time4 = time.time()*1000
     self.initial_time5 = time.time()*1000
     self.initial_time6 = time.time()*1000
     self.initial_time7 = time.time()*1000
     self.initial_spark = time.time()*1000
     self.initial_explosion = time.time()*1000
     self.kameham_ms = 160
     self.punch_ms = 90
     self.staticy = 0
     self.initial_kame = time.time()*1000
     self.initial_punch = time.time()*1000
     self.initial_effects = time.time()*1000
     self.is_pc = True
     self.single_kameham = True
     self.teleport_boolean = True
     self.kame_cont = 22
     self.attack_rect = None
     self.hp_rect = None
     self.xp_rect = None
     self.initial_death = 0
Exemplo n.º 5
0
def scrolling_text(text, start_from_right=True, scroll_length=1):
    """
    take in a string, output a generator that is a series of
    frames (5x7 matrices)
    """
    if start_from_right:
        matrix = [[0 for _ in range(6)] for __ in range(5)]
    else:
        matrix = [[] for _ in range(5)]

    for char in list(text):
        trimmed_char = _trim_frame(Characters.string_to_matrices(char)[0])

        for i in range(5):
            matrix[i] += trimmed_char[i] + [0]

        while len(matrix[0]) >= 7:
            yield [col[:7] for col in matrix]
            matrix = [col[scroll_length:] for col in matrix]

    while (len(matrix[0]) > 0):
        padding = [0 for _ in range(7 - len(matrix[0]))]
        yield [matrix[i] + padding for i in range(5)]

        matrix = [col[scroll_length:] for col in matrix]
Exemplo n.º 6
0
 def __init__(self):
     self.view = View()
     self.map = Map()
     self.characters = Characters('anyadat')
     self.hero = Hero()
     self.skeleton = Skeleton()
     self.boss = Boss()
     self.view.draw_map(self.map.gamezone1)
Exemplo n.º 7
0
    def generate_pw(self):

        ch = Characters()

        capital_letters = ch.capital_alphabets()
        small_letters = ch.small_alphabets()
        numbers = ch.numbers()
        symbols = ch.symbols()

        chars = [capital_letters, small_letters, numbers, symbols]
        pw = ""

        length = range(int(input("how long should the password be? ")))

        # length of password hardcoded to 7
        for l in length:
            # random index for chars array
            index1 = int(random.uniform(0, 4))
            # random index to take within each char group
            index2 = int(random.uniform(0, len(chars[index1])))
            character = chars[index1][index2]
            pw += str(character)
        return pw
Exemplo n.º 8
0
from characters import Characters
from quadrant import Quadrant
import copy
from content import Content

# creación de una instancia de Characters
characters = Characters()
# creación de los cuadrantes del espiral 
# con la capacidad de items a contener
quadrant_1 = Quadrant(2)
quadrant_2 = Quadrant(3)
quadrant_3 = Quadrant(5)
quadrant_4 = Quadrant(8)
quadrant_5 = Quadrant(13)
quadrant_6 = Quadrant(21)
# le proveemos a los cuadrantes el array de caracteres base
# y le indicamos a partir de que indice comenzar agregarlos
quadrant_1.add( characters.chars, 0 )
quadrant_2.add( characters.chars, 2 )
quadrant_3.add( characters.chars, 5 )
quadrant_4.add( characters.chars, 10)
quadrant_5.add( characters.chars, 18)
quadrant_6.add( characters.chars, 31)

# Entidad encargada de la enciptación y desencriptación de frases
class Encrypter:
    
    def __init__(self):
        # objeto para manejo de contenido
        self.content = Content()
        # cuadrantes que manejará
Exemplo n.º 9
0
 def __init__(self, initial_action, player_id):
     """
     Initiation of the player states
     """
     Characters.__init__(self, initial_action, player_id)
     self.pos = 1
     self.pos2 = 1
     self.movex, self.movey = 0, 0
     self.facing_right = True
     self.x = 250
     self.y = 350
     self.Rect = pygame.Rect(self.x, self.y, 35, 70)
     self.hp = 400
     self.xp = 50
     self.XP_MAX = 150
     self.defending = False
     self.attacking = False
     self.initial_time = 0
     self.timing2 = True
     self.timing_dispute = False
     self.punch_damage = 2
     self.kick_damage = 2
     self.hit_defended = 0.4
     self.power_damage = 10
     self.power_damage_defended = 2
     self.combo_damage = 10
     self.player_id = player_id
     self.loading = False
     self.super_punch_state = False
     self.super_kick_state = False
     self.factor_super = 1.4
     if self.player_id == 1:
         self.k_down = pygame.K_s
         self.k_up = pygame.K_w
         self.k_defend = pygame.K_p
         self.k_kameham = pygame.K_u
         self.k_punch = pygame.K_i
         self.k_kick = pygame.K_o
         self.k_load = pygame.K_j
         self.k_rightArrow = pygame.K_d
         self.k_leftArrow = pygame.K_a
         self.k_combo = pygame.K_c
         self.k_teleport = pygame.K_k
     elif self.player_id == 2:
         self.k_down = pygame.K_DOWN
         self.k_up = pygame.K_UP
         self.k_defend = pygame.K_KP5
         self.k_kameham = pygame.K_KP7
         self.k_punch = pygame.K_KP8
         self.k_kick = pygame.K_KP9
         self.k_load = pygame.K_KP4
         self.k_rightArrow = pygame.K_RIGHT
         self.k_leftArrow = pygame.K_LEFT
         self.k_combo = pygame.K_n
         self.k_teleport = pygame.K_KP6
     self.initial_spark = time.time()*1000
     self.initial_explosion = time.time()*1000
     self.initial_time2 = 0
     self.release_power = True
     self.void_power = True
     self.kame_cont = 0
     self.enemy_kame_cont = 0
     self.staticy = 0
     self.initial_kame = time.time()*1000
     self.initial_punch = time.time()*1000
     self.initial_effects = time.time()*1000
     self.is_pc = False
     self.single_kameham = True
     self.dispute_kameham_boolean = True
     self.attack_rect = None
     self.hp_rect = None
     self.xp_rect = None
     self.initial_death = 0
     self.press_counter = 0
Exemplo n.º 10
0
 def __init__(self, initialAction, playerId, speed = 15):
     """
     Iniciation of the player states
     """
     Characters.__init__(self,initialAction, speed = 15)
     self.pos = 1
     self.pos2 = 1
     self.movex, self.movey = 0,0
     self.facingRight = True
     self.x = 250
     self.y = 350
     self.Rect = Rect(self.x, self.y, 35, 70)
     self.HP = 400
     self.XP = 50
     self.XPMAX = 150
     self.Defending = False
     self.Attacking = False
     self.punchDamage = 0
     self.kickDamage = 0
     self.hitDefended = 0
     self.powerDamage = 0
     self.powerDamageDefended = 0
     self.initialTime = 0
     self.timing2 = True
     self.timingDispute = False
     self.punchDamage = 2
     self.kickDamage = 2
     self.hitDefended = 0.4
     self.powerDamage = 10
     self.powerDamageDefended = 2
     self.comboDamage = 10
     self.playerId = playerId
     self.loading = False
     self.superPunchState = False
     self.superKickState = False
     self.factorSuper = 1.4
     if self.playerId == 1:
         self.k_down = K_s
         self.k_up = K_w
         self.k_defend = K_p
         self.k_kameham = K_u
         self.k_punch = K_i
         self.k_kick = K_o
         self.k_load = K_j
         self.k_rightArrow = K_d
         self.k_leftArrow = K_a
         self.k_combo = K_c
         self.k_teleport = K_k
     elif self.playerId == 2:
         self.k_down = K_DOWN
         self.k_up = K_UP
         self.k_defend = K_KP5
         self.k_kameham = K_KP7
         self.k_punch = K_KP8
         self.k_kick = K_KP9
         self.k_load = K_KP4
         self.k_rightArrow = K_RIGHT
         self.k_leftArrow = K_LEFT
         self.k_combo = K_n
         self.k_teleport = K_KP6
     self.initialSpark = time.time()*1000
     self.initialExplosion = time.time()*1000
     self.initialTime2 = 0
     self.kamehamMs = 160
     self.punchMs = 90
     self.releasePower = True
     self.voidPower = True
     self.kameCont = 22
     self.enemykameCont = 0
     self.staticy = 0
     self.initialKame = time.time()*1000
     self.initialPunch = time.time()*1000
     self.initialEffects = time.time()*1000
     self.isPC = False
     self.singleKameham = True
     self.disputeKamehamBoolean = True
Exemplo n.º 11
0
 def __init__(self, x, y):
     Characters.__init__(self, x, y, 0, 0)
     self.image = pygame.image.load("./images/hero.png").convert_alpha()
     self.rect = self.image.get_rect()
     self.rect.center = self.x, self.y
Exemplo n.º 12
0
 def __init__(self, x, y, dir_x, dir_y):
     Characters.__init__(self, x, y, dir_x, dir_y)
     self.change_mv_cd = 60
     self.image = pygame.image.load("./images/monster.png").convert_alpha()
     self.rect = self.image.get_rect()
     self.rect.center = self.x, self.y
Exemplo n.º 13
0
 def __init__(self, initial_action, player_id):
     """
     Initiation of the player states
     """
     Characters.__init__(self, initial_action, player_id)
     self.pos = 1
     self.pos2 = 1
     self.movex, self.movey = 0, 0
     self.facing_right = True
     self.x = 250
     self.y = 350
     self.Rect = pygame.Rect(self.x, self.y, 35, 70)
     self.hp = 400
     self.xp = 50
     self.XP_MAX = 150
     self.defending = False
     self.attacking = False
     self.initial_time = 0
     self.timing2 = True
     self.timing_dispute = False
     self.punch_damage = 2
     self.kick_damage = 2
     self.hit_defended = 0.4
     self.power_damage = 10
     self.power_damage_defended = 2
     self.combo_damage = 10
     self.player_id = player_id
     self.loading = False
     self.super_punch_state = False
     self.super_kick_state = False
     self.factor_super = 1.4
     if self.player_id == 1:
         self.k_down = pygame.K_s
         self.k_up = pygame.K_w
         self.k_defend = pygame.K_p
         self.k_kameham = pygame.K_u
         self.k_punch = pygame.K_i
         self.k_kick = pygame.K_o
         self.k_load = pygame.K_j
         self.k_rightArrow = pygame.K_d
         self.k_leftArrow = pygame.K_a
         self.k_combo = pygame.K_c
         self.k_teleport = pygame.K_k
     elif self.player_id == 2:
         self.k_down = pygame.K_DOWN
         self.k_up = pygame.K_UP
         self.k_defend = pygame.K_KP5
         self.k_kameham = pygame.K_KP7
         self.k_punch = pygame.K_KP8
         self.k_kick = pygame.K_KP9
         self.k_load = pygame.K_KP4
         self.k_rightArrow = pygame.K_RIGHT
         self.k_leftArrow = pygame.K_LEFT
         self.k_combo = pygame.K_n
         self.k_teleport = pygame.K_KP6
     self.initial_spark = time.time() * 1000
     self.initial_explosion = time.time() * 1000
     self.initial_time2 = 0
     self.release_power = True
     self.void_power = True
     self.kame_cont = 0
     self.enemy_kame_cont = 0
     self.staticy = 0
     self.initial_kame = time.time() * 1000
     self.initial_punch = time.time() * 1000
     self.initial_effects = time.time() * 1000
     self.is_pc = False
     self.single_kameham = True
     self.dispute_kameham_boolean = True
     self.attack_rect = None
     self.hp_rect = None
     self.xp_rect = None
     self.initial_death = 0
     self.press_counter = 0