A common mistake that peaple do with functions is that they forget that variables created within the functions are locals, unless theres a same global variable named. Also some create functions with procedures that aren't supposed to end up being a function, or at least not just in 1.
Common example is when either you need to pass like 10 values to the function, wich within it would represent the same values outside, and almost no local variables, or when all variables within the function are globals.
As far as i get to know, i create a function when i need to calculate or do something with a few values, and it's a process that is done more than once in one cycle, for example calculating the next position of an object according to its former position, direccion and speed.
Those and the object id would be the only values i would pass, then i could call that function with either the hero or enemies.
Functions shouldn't be just for 1 procedure, but try to acomplish that same procedure whenever its needed, regardless if its the hero, an enemy, a bird, boat.... even the sky if you wish....
Further on my stuff at...