예제 #1
0
    def __init__(self, scene_config, adventure):
        self.__frame = pygame.Surface(video.Screen().get_size()).convert_alpha()
        self.__config = scene_config
        self.__adventure = adventure
        
        self.__background = self.__config.get('scenario', None)
        if self.__background is None:
            self.__background = video.empty_image()
        else:
            self.__background = video.load_image(self.__background)

        self.__intro = self.__config.get('intro', None)
        self.__outtro = self.__config.get('outtro', None)
        
        self.__script = self.__config.get('script', [])
        self.__script.reverse()
        self.__interpreter = script.Interpreter(self)

        self.__layout = None
예제 #2
0
    def enter_actor(self, filename):
        _DEB('Enter actor: %s' % filename)
        self.__assert_video_enabled__()

        # Move current actors
        new_positions = self.__get_center_points(len(self.__actors) + 1)
        pos_idx = 0
        drawed_actors = []
        for actor in self.__actors:
            actor_width = self.__actor_image[actor].get_width()
            new_pos = (new_positions[pos_idx] - (actor_width / 2),
                       self.__actor_position[actor][1])
            self.__draw_scene(drawed_actors)
            transitions.move(self.__actor_image[actor],
                             self.__actor_position[actor],
                             new_pos,
                             .5)
            drawed_actors.append(actor)
            self.__actor_position[actor] = new_pos
            pos_idx += 1
            
        # Put new actor
        self.__actors.append(filename)
        self.__actor_image[filename] = video.load_image(filename)
        actor_width = self.__actor_image[filename].get_width()
        actor_row = (self.__video.size[1] -
                     self.__actor_image[filename].get_height())
        self.__actor_position[filename] = (
            new_positions[pos_idx] - (actor_width / 2),
            actor_row
        )
        self.__draw_scene(drawed_actors)
        transitions.move(self.__actor_image[filename],
                         (-actor_width, actor_row),
                         self.__actor_position[filename],
                         1.0)
예제 #3
0
 def show_image(self, filename):
     _DEB('Show image: %s' % filename)
     self.__assert_video_enabled__()
     image = video.load_image(filename)
     self.__show_image__(image)
예제 #4
0
 def load_image(self, filename):
     _DEB('Load image: %s' % filename)
     return video.load_image(filename)