espace Posted July 15, 2016 Share Posted July 15, 2016 hi, my desire is this : have one file main.js and have other files like background.js call a variable like background in my main.js just in one line ...without be preocupated with preload, create, update and render i want in fact, if i have modification on one var like background just edited one file and not do the modification at 3 times in my main.js (preload, create,render) is it possible ? i have google a lot of this and i have found many solution but could you please give me a concrete example with this file ... thanks in advance //main.js var game = new Phaser.Game(w, h, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.image('rect','rect.png'); } var background =[]; function create() { background.opponent=game.add.sprite(0,0,'rect'); background.player=game.add.sprite(w2,0,'rect'); } function update() { background.opponent.tint=0xff4f4f background.opponent.width=w2 background.opponent.height=h background.player.tint=0x25a7ba background.player.width=w2 background.player.height=h } function render() { } Link to comment Share on other sites More sharing options...
carlosnufe Posted July 15, 2016 Share Posted July 15, 2016 Hi, You have multiple choises as you have said. I have one of them in my project proprosal template. Check it, https://github.com/carlosnufe/phaserjs-project-template-es5 . I use browserify but for example webpack is trendy right now, you can check it in internet tutorials. I hope it helps to resolve your doubts Link to comment Share on other sites More sharing options...
espace Posted July 15, 2016 Author Share Posted July 15, 2016 yes, it joined that Emmanuel described in this post : http://www.emanueleferonato.com/2014/08/28/phaser-tutorial-understanding-phaser-states/ I do not yet see clearly the concrete benefits grunt ... can you enlighten me on the subject ? Link to comment Share on other sites More sharing options...
Recommended Posts