I need a help in understanding the difference between two the follwing two codes:
Phaser.GameObjects.GameObjectFactory.register('abc', function(x,y,z){ const abc new ABC(this.scene,x,y,z)}; ......);
and
Phaser.GameObjects.GameObjectFactory.register('abc', (x,y,z)=>{ const abc new ABC(this.scene,x,y,z)}; ......);
Code that is calling the above code:
this.add.abc(1,2,3);
The second code is not working with the code trace saying this is undefined but the same code is working flawlessly. I know the problem is due to the two different ways of writing the callback method i.e. using function(){} and arrow function ()=>{}, I want to undertand what is that difference which is creating this issue.
Thanks for your help.