def _selected_fn(spr: cocosnode.CocosNode): self.orig_scale = spr.scale self.orig_pos = spr.position spr.scale *= 2 y_ratio = spr.y / get_height() if y_ratio < 0.5: spr.y = min(y_ratio + 0.13, 0.5) * get_height() else: spr.y = max(y_ratio - 0.13, 0.5) * get_height() if self.move_to_top: set_z(spr, z='top')