Hello!
I just started playing around with Phaser today and I'm enjoying it a lot. I come from a frontend / UI engineering background so I'm used to modularizing my components and tying them together using require statements. So far, all the examples I've seen in Phaser are all written in a single file which makes me uncomfortable if my game is to become more complicated. For example I have a group called "ships" which can all shoot "weapons" I want each ship to have properties like current ammo, health, player_id, etc. However I've only been able to define them this way.
ships = game.add.physicsGroup();
// ships.enableBody = true
/* SET UP PLAYER */
player = ships.create(0, 0, 'ship');
player.anchor.setTo(0.5, 0.5);
game.physics.arcade.enable(player);
/* SET UP LASER */
laser = game.add.weapon(30, 'bullet'); // fire 30 shots every 100ms
laser.bulletKillType = Phaser.Weapon.KILL_DISTANCE;
laser.bulletKillDistance = 500;
laser.bulletRotateToVelocity = true;
laser.bulletSpeed = 600;
laser.fireRate = 100;
laser.trackSprite(player, 0, 0, true);
Now I would ideally like to have something like this:
class Ship {
constructor(x, y){
ships.create(x, y,'ship');
...
health = 500;
armor = 600;
ammoCapacity = 1000;
currentAmmo = 1000;
}
}
But currently I have to declare a ton of global variables. I found the phaser-es6-boilerplate. Is this is the standard and should I be safe following the paradigms expressed there?
Thanks for any feedback!

Hello,
I started a hobby project to learn Phaser (https://github.com/alessandronunes/soccerpunch). It's lika a Clash Royale Soccer, with punchs (not implemented yet).
The code is growing and I need to split the game logic in more than one file. I have knowledge of some Javascript frameworks, like Sencha and JQuery Mobile, and I'm familiar to the MVC concept.
I'll probably try to create files for every game object (Player.js, Goal.js, Ball.js, etc.).
So I would like to ask: how do you organize your code files? Please send examples!