Hello guys
I have recently started doing my projects in ES6 and I am wondering the following.
//Player.js
class Player extends Phaser.Image
{
constructor(game, x, y, sheet, key)
{
super(game, x, y, sheet, key);
}
}
export default Player;
//GameState.js
import Player from 'views/Player';
class GameState extends Phaser.State {
create()
{
this.player = new Player(); // Cannot see required parameters
//If I call it like that
this.player = Player.constructor() // I can see them - obviously
}
}
export default GameState;
Should I just initialize the new Player and then just call the constructor so I can actually create what I need?