Search the Community
Showing results for tags 'better performance'.
-
Now I have only one javascript file which included many states there. Here is my sample code: var WelcomeState = { preload: function () { game.load.image('bg1', 'games/RockPaperScissors/assets/Game0002.png'); }, create: function () { game.add.sprite(0, 0, 'bg1'); }, start: function () { this.game.state.start('instruct'); }// other methods....};var InstructState = { preload: function () { game.load.image('bg2', 'games/RockPaperScissors/assets/Game0001.png'); game.load.image('guide', 'games/RockPaperScissors/assets/Game0015.png'); game.load.spritesheet('readyPlay', 'games/RockPaperScissors/assets/ready.png', 130, 46); }, readyPlay: function () { this.game.state.start('rockpaperscissor'); }// other methods....};var game = new Phaser.Game(480, 360, Phaser.AUTO, 'game_container', null, false, false);game.state.add('welcome', WelcomeState);game.state.add('instruct', InstructState);game.state.start('welcome');Can anyone tell me the best practice way to separate Javascript file in order to get better performance of the game?
- 3 replies
-
- separate javascript file
- better performance
-
(and 1 more)
Tagged with: