add function for playerobj