player and ball function