def __init__(self): self.facing_x = 1 self.score = 0 sprite = retro.Sprite.from_spritesheet( path=asset('player.png'), animations=retro.Animations( frame_size=(10, 11), period=30, IDLE_R=([1], 0), IDLE_L=([4], 0), WALK_R=([0, 1, 2, 1], 0), WALK_L=([3, 4, 5, 4], 0), ), ) retro.Sprite.__init__(self, sprite.image, sprite.animations) self.reset_position()
def __init__(self): self.tile_size = 20 retro.Sprite.__init__(self, retro.Image(asset('maze.png'))) self.image.scale(self.tile_size) self.init_items()
def init_treasure(xsq, ysq): sprite = retro.Sprite.from_path(asset('treasure.png')) sprite.rect.move_ip(xsq, ysq) self.image.draw_rect(retro.BLACK, sprite.rect) self.items.append(sprite) self.treasures.append(sprite)
def init_trap(xsq, ysq): sprite = retro.Sprite.from_path(asset('trap.png')) sprite.rect.move_ip(xsq, ysq) self.items.append(sprite) self.traps.append(sprite)
def init_exit(xsq, ysq): self.exit = retro.Sprite.from_path(asset('exit.png')) self.exit.rect.move_ip(xsq, ysq) self.items.append(self.exit)