Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
PyscrollDataAdapter.get_animations must be implemented
"""
self._update_time()
self._animation_queue = list()
self._tracked_gids = set()
self._animation_map = dict()
for gid, frame_data in self.get_animations():
self._tracked_gids.add(gid)
frames = list()
for frame_gid, frame_duration in frame_data:
image = self._get_tile_image_by_id(frame_gid)
frames.append(AnimationFrame(image, frame_duration))
# the following line is slow when loading maps, but avoids overhead when rendering
# positions = set(self.tmx.get_tile_locations_by_gid(gid))
# ideally, positions would be populated with all the known
# locations of an animation, but searching for their locations
# is slow. so it will be updated as the map is drawn.
positions = set()
ani = AnimationToken(positions, frames, self._last_time)
self._animation_map[gid] = ani
heappush(self._animation_queue, ani)