Balamurugan Posted February 24, 2018 Share Posted February 24, 2018 I have 2 files as below: file 1- var deck = 0; var game = { fun: function() { statements; } } file 2 - var game1 = { I need to call file 1function. I dont know how to call. } i am beginner for phaser 3. i dont know how to call.. Link to comment Share on other sites More sharing options...
Horizonicblue Posted February 24, 2018 Share Posted February 24, 2018 I think this should work var game1 = { game.fun(); } Link to comment Share on other sites More sharing options...
Balamurugan Posted February 26, 2018 Author Share Posted February 26, 2018 On 2/24/2018 at 10:06 PM, Horizonicblue said: I think this should work var game1 = { game.fun(); } Is working fine thank you so much. But i also have a globel variable deck in file 1, or anyother options there, set a common global variable and use in another class. how to access also, please help us.. Link to comment Share on other sites More sharing options...
Horizonicblue Posted February 26, 2018 Share Posted February 26, 2018 You can access it as deck in any of the states. (actually in this structure even objects like game and game1 are global) other way of declaring global is game.global = { score : 0, sound : false } and you can access it as game.global.score in any states. Balamurugan 1 Link to comment Share on other sites More sharing options...
Balamurugan Posted March 1, 2018 Author Share Posted March 1, 2018 Ok, thank you so much, i don't how to give reputation point to you, please share how to give reputation point to you... And also i working this example i dont know how it is working. Please explain that, i attach my demo files. Link to comment Share on other sites More sharing options...
Horizonicblue Posted March 2, 2018 Share Posted March 2, 2018 On 3/1/2018 at 4:37 PM, Balamurugan said: And also i working this example i dont know how it is working. Please explain that, i attach my demo files. demo.rar Hey the attachment is not extracting for me, can you reattach a new one.. Link to comment Share on other sites More sharing options...
Balamurugan Posted March 3, 2018 Author Share Posted March 3, 2018 Here i re attach the demo, Thank You for your response... demo.zip Link to comment Share on other sites More sharing options...
Recommended Posts