refactor pacman animation