If you only want IfCalled() to run when moveSnakeRight() is called, could you not put the call inside of moveSnakeRight()?
function ifCalled() {
// do something
}
function moveSnakeRight() {
// do this function's task...
ifCalled();
return ...
}
It looks like you’re using the IfCalled() function to set a property on another object anyway, so this should accomplish the same thing… but it’s a bit difficult to piece together entirely from just those little snippets.