Your "Game Primary Script" has
which is a call to refreshFIG passing in no arguments. But you have defined refreshFIG as taking four arguments.
When you have a line such as
function refreshFIG( src, event, WALL_L, WALL_R)
then it does not mean "look around and find an execution-time value for each of the variables named and allow the current value to be used.
What it does mean is that the calling routine must pass in several values when it makes the call, and whatever value is passed in to the routine is to be given the temporary variable name inside the routine by matching the name positions in the "function" statement to the position of the value in the call to the function.
When a name is declared in a "function" statement argument list, then inside that routine, the correspondence between name and calling-position value overrides all other uses of that variable name that might otherwise have existed. Overrides use of the name as a MATLAB built-in function; overrides any fetching of the variable from any nested scope; overrides use of the name as indicating a class. In theory if you were to have a dummy argument name that was the same as the internal name of one of the operators, calling the operator would invoke the function handle passed in. For example if you were to use "minus" as an argument name, then in theory a-b would call that minus() instead of the normal builtin minus(a,b) that would otherwise be called. Therefore if you have a name that occurs in the argument list of your current function, then the only way for the named variable to have a value is if the function was called in a way that supplied an argument to that position.
Best Answer