Ejemplo n.º 1
0
 def set_target(self):
     for target in game_world.layer_objects(game_world.player_layer):
         if target.x >= self.x - self.range and not target.cur_state == DEAD1:
             self.target = target
             return BehaviorTree.SUCCESS
     for snow_wall in game_world.layer_objects(game_world.snow_wall_layer):
         if snow_wall.x >= self.x - self.range and not snow_wall.dir:
             self.target = snow_wall
             return BehaviorTree.SUCCESS
     return BehaviorTree.FAIL
Ejemplo n.º 2
0
 def set_target(self):
     if random.randint(0, 1):
         for target in game_world.layer_objects(game_world.player_layer):
             if target.cur_state != DEAD1:
                 if target.x > self.x - self.range:
                     self.target = target
                     return BehaviorTree.SUCCESS
     else:
         for target in game_world.layer_objects(game_world.player_layer):
             if target.cur_state != DEAD1 and \
                     target.x > self.x - self.range and not target.targeted:
                 self.target = target
                 self.target.targeted = True
                 return BehaviorTree.SUCCESS
     return BehaviorTree.FAIL
Ejemplo n.º 3
0
 def snow_collision_check(self):
     for snow in game_world.layer_objects(game_world.snow_layer):
         if snow.vx > 0:
             if snow.collision_object(*self.get_hit_box()):
                 self.hit_by_snow(snow)
                 if snow.type == 3 and main_state.Data.weapon_level[3] >= 3:
                     self.x += 25
Ejemplo n.º 4
0
 def find_cover(self):
     if not self.cover:
         for wall in game_world.layer_objects(game_world.snow_wall_layer):
             if self.x - 150 <= wall.x <= min(self.x + 150, self.target.x + self.range):
                 self.target_position = wall.x + 50 + random.randint(-10, 30)
                 return BehaviorTree.SUCCESS
     return BehaviorTree.FAIL
Ejemplo n.º 5
0
 def snow_collision_check(self):
     for snow in game_world.layer_objects(game_world.snow_layer):
         if snow.vx > 0:
             if self.is_divided:
                 if snow.collision_object(*self.get_sled_hit_box()):
                     self.hit_by_snow(snow)
             else:
                 if snow.collision_object(*self.get_sled_hit_box()) or snow.collision_object(*self.get_person_hit_box()):
                     self.hit_by_snow(snow)
Ejemplo n.º 6
0
    def set_target(self):
        if random.randint(0, 1):
            nearest = None
            for enemy in game_world.layer_objects(game_world.enemy_layer):
                if enemy.cur_state != DEAD1 and enemy.cur_state != DEAD2 and enemy.cur_state != DEAD3 and\
                        stage_state.base_x + 500 < enemy.x < stage_state.base_x + 1200:
                    if nearest == None:
                        nearest = enemy
                    elif nearest.x > enemy.x:
                        nearest = enemy
            if nearest != None:
                self.target = nearest
                self.target.targeted = True
                return BehaviorTree.SUCCESS

        else:
            for enemy in game_world.layer_objects(game_world.enemy_layer):
                if enemy.cur_state != DEAD1 and enemy.cur_state != DEAD2 and enemy.cur_state != DEAD3 and \
                        stage_state.base_x + 500 < enemy.x < stage_state.base_x + 1200 and not enemy.targeted:
                    self.target = enemy
                    self.target.targeted = True
                    return BehaviorTree.SUCCESS

        return BehaviorTree.FAIL
Ejemplo n.º 7
0
    def find_target_wall(self):
        farthest = None
        for wall in game_world.layer_objects(game_world.snow_wall_layer):
            if stage_state.player.x - 250 <= wall.x <= stage_state.player.x + 50 and wall.occupied == False and wall.max_hp > wall.hp:
                if farthest == None:
                    farthest = wall
                elif farthest.x < wall.x:
                    farthest = wall
                if self.target_wall == None:
                    self.target_wall = wall

        if farthest == None:
            self.target_wall = None
            return BehaviorTree.FAIL
        else:
            self.target_wall = farthest
            return BehaviorTree.SUCCESS
Ejemplo n.º 8
0
    def do(character):

        if character.frame == 15:
            find_wall = False

            for sw in game_world.layer_objects(game_world.snow_wall_layer):
                if sw.check_existence(character.x, character.x + 60):
                    sw.strengthen_wall(character.shovel_power)
                    find_wall = True

            if find_wall == False:
                game_world.add_object(snow_wall.SnowWall(character.x, False, character.snow_wall_level, character.shovel_power), game_world.snow_wall_layer)

            character.frame = 0
        else:
            if character.frame == 0:
                character.make_wall_sound.play()
            character.frame += 1
Ejemplo n.º 9
0
 def collision_snow(self):
     for snow in game_world.layer_objects(game_world.snow_layer):
         if snow.type != 2:
             if snow.collision_object(*self.get_hit_box()):
                 self.hit_by_snow(snow)
Ejemplo n.º 10
0
 def snow_collision_check(self):
     for snow in game_world.layer_objects(game_world.snow_layer):
         if snow.vx < 0:
             if snow.collision_object(*self.get_hit_box()):
                 self.hit_by_snow(snow)
Ejemplo n.º 11
0
 def check_range(self):
     for target in game_world.layer_objects(game_world.player_layer):
         if target.x > self.x - self.range and not target.cur_state == DEAD1:
             self.target = target
             return BehaviorTree.SUCCESS
     return BehaviorTree.FAIL
Ejemplo n.º 12
0
 def wall_duplication_check(self):
     for w in game_world.layer_objects(game_world.snow_wall_layer):
         if w.dir and self.wall_pos - 60 < w.x - stage_state.base_x + 60 and self.wall_pos + 60 > w.x - stage_state.base_x - 60:
             return True
     return False
Ejemplo n.º 13
0
 def check_range(self):
     for target in game_world.layer_objects(game_world.player_layer):
         if target.x > self.x - self.range:
             return BehaviorTree.SUCCESS
     return BehaviorTree.FAIL