Greetings,
Quick question: How do I dynamically update the arguments of this loop from the update function to reflect the actual coordinates of the pointer? (This loop is found in the create() function)
Game.mouseTimer = game.time.events.loop(
100,
Client.sendMousePos,
Client.class,
game.input.mousePointer.x,
game.input.mousePointer.y
);
I have already attempted several techniques, such as including this code snippet in the update function; However, it throws an Uncaught TypeError: Cannot set property '0' of undefined error.
Game.mouseTimer.args[0] = game.input.mousePointer.x;
Game.mouseTimer.args[1] = game.input.mousePointer.y;
To go around the error, I tried to manually initialize the Game.mouseTimer.args array before the loop. This did indeed avoid the error; However, it only updated the arguments once.
Thanks.