How to use the pyscroll.renderer.AnimationToken function in pyscroll

To help you get started, we’ve selected a few pyscroll examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitcraft / pyscroll / pyscroll / renderer.py View on Github external
def reload_animations(self):
        self.update_time()
        self.animation_map = dict()
        self.animation_queue = list()

        for gid, frame_data in self.data.get_animations():
            frames = list()
            for frame_gid, frame_duration in frame_data:
                image = self.data.get_tile_image_by_gid(frame_gid)
                frames.append(AnimationFrame(image, frame_duration))

            ani = AnimationToken(gid, frames)
            ani.next += self.last_time

            self.animation_map[ani.gid] = ani.frames[ani.index].image
            heappush(self.animation_queue, ani)