animations.append(Animation(image_frames)) return animations window = Window(800, 600, resizable=True) scale = 1.0 camera_x = 0.0 camera_y = 0.0 label_fps = pyglet.text.Label('FPS', font_name='Times New Roman', font_size=12, x=795, y=5, anchor_x='left', anchor_y='top') actor = act_open('./wolf.act') sprites = spr_open('./wolf.spr') animations = setup_animations(actor, sprites) drawableObjects = [Sprite(x=x, y=y,img=imgs) for x, y, imgs in [ (0, 0, animations[0]), (100, 0, animations[4]), (200, 0, animations[8]), (300, 0, animations[12]), (400, 0, animations[16]), (500, 0, animations[20]), ]] drawableObjects = [(i.x, i.y, i) for i in drawableObjects]
if len(image_frames): speed = animation.speed animations.append(Animation(image_frames, int(speed*40))) return animations if __name__ == '__main__': pygame.init() display = pygame.display.set_mode((800, 600)) screen = pygame.Surface(display.get_size()) draw_objects = [] wolfs = setup_animations(act_open('wolf.act'), spr_open('wolf.spr')) wolfs = [x for i, x in enumerate(wolfs) if i % 4 == 0] y = 20 for i in wolfs: i.x = 50 i.y = y y += 100 draw_objects += wolfs lunatics = setup_animations(act_open('lunatic.act'), spr_open('lunatic.spr')) lunatics = [x for i, x in enumerate(lunatics) if i % 4 == 2] y = 20 for i in lunatics: i.x = 250 i.y = y y += 100