Exemplo n.º 1
0
    def create_curse(self):
        #Create Level curse
        # GREEN
        damage = 10
        stun = 10
        cooldown = 50
        position = [0,0]
        '''
        temp_eff = pygame.image.load(os.path.join('data', 'curse_green_effect.png'))
        eff_sprite = components.Appearance(temp_eff.convert_alpha(), 114, 128, [8], [47])
        eff_sprite.play_animation_till_end = True
        eff_sprite.play_once = True
        effect_ID = self.create_entity((eff_sprite, ))
        '''
        effect_ID = self.create_attack_effect('curse_green_effect.png', 114, 128, 8, 47)
        curse_AI = ai.Level1_curse(self, 0, self.event_manager)
        curse_ID = self.create_entity((curse_AI, ))
        curse_AI.entity_ID = curse_ID
        #Create projectile image
        proj_image = "projectile_fly_orange.png"
        proj_anim_list = [4, 4]
        proj_anim_time_list = [37, 13]
        proj_width = 50
        proj_height = 50
        proj_life = 60
        speed = 3
        particle_emitter = components.Attack(self, damage, stun, cooldown, position,
                                             1, proj_image, proj_anim_list, proj_anim_time_list,
                                             proj_width, proj_height, proj_life,
                                             speed, [0, 0], 15, effect_ID)
        attack_list = list()
        attack_list.append(particle_emitter)
        self.add_component_to_entity(curse_ID, attack_list)

        # PINK
        damage = 10
        stun = 27
        cooldown = 0
        position = [0,0]
        # Other effect for this curse is set in ai.py
        effect_ID2 = self.create_attack_effect('tentakel.png', 60, 100, 9, 60)
        curse_AI2 = ai.Level2_curse(self, 0, self.event_manager)
        curse_ID2 = self.create_entity((curse_AI2, ))
        curse_AI2.entity_ID = curse_ID2
        #Create projectile image
        proj_image = "pink_proj.png"
        proj_anim_list = [2, 2]
        proj_anim_time_list = [47, 10]
        proj_width = 32
        proj_height = 32
        speed = 2
        proj_life = 33 
        particle_emitter = components.Attack(self, damage, stun, cooldown, position,
                                             1, proj_image, proj_anim_list, proj_anim_time_list,
                                             proj_width, proj_height, proj_life,
                                             speed, [0, 0], 15, effect_ID2)
        particle_emitter.piercing = True
        attack_list = list()
        attack_list.append(particle_emitter)
        self.add_component_to_entity(curse_ID2, attack_list)
Exemplo n.º 2
0
 def create_attack(self,
                   position,
                   damage,
                   stun,
                   cooldown,
                   proj_amount,
                   projectile_image,
                   proj_anim_list,
                   proj_anim_time_list,
                   width,
                   height,
                   projlife,
                   projspeed,
                   accel,
                   spread,
                   effect_ID=None):
     """
     :param position: position of attack
     :type position: 2D list 
     :param damage: damage
     :type damage: int
     :param stun: stun inflicted by attack in frames
     :type stun: int
     :param cooldown: cooldown in frames
     :type cooldown: int
     :param proj_amount: amount of projectiles pro attack 
     :type proj_amount: int
     :param projectile_image: image representation of projectile 
     :type projectile_image:
     :param projlife: projectile lifetime in frames
     :type projlife: int
     :param projspeed: projectile_speed
     :type projspeed: int
     :param accel: acceleration
     :type accel: 2d list
     :param spread: spread angle
     :type spread: int
     :param effect_ID: ID of previously created effect representation
     :type effect_ID: int
     :rtype: created Attack
     """
     if not damage:
         damage = 10
     if not stun:
         stun = 30
     if not cooldown:
         cooldown = 30
     if not proj_amount:
         proj_amount = 1
     if not projlife:
         projlife = 60
     if not spread:
         spread = 15
     attack = components.Attack(self, damage, stun, cooldown, position,
                                proj_amount, projectile_image,
                                proj_anim_list, proj_anim_time_list, width,
                                height, projlife, projspeed, [0, 0], spread,
                                effect_ID)
     return attack
Exemplo n.º 3
0
def creature(**args):
    """Creature components."""
    if "image" not in args:
        args["image"] = None

    components = [
        c.Render(args["image"]),
        c.TilePosition(args["x"], args["y"]),
        c.Movement(diagonal=args["diagonal"]),
        c.Blocker(),
        c.Health(args["health"]),
        c.Attack(args["attack"]),
    ]
    if "anim_idle" in args:
        components.append(
            c.Animation(idle=args["anim_idle"], ready=args["anim_ready"]))
    if "speed" in args:
        components.append(c.Initiative(args["speed"]))

    return components