added agent animation code