Separate Sprite and GameObject

The character class actually needs to be a game object, since it will deal with all the physics. It needs a body with a size, coordinates and velocity, so it can moves and interact with other element in the scene, as other character, but also tiles, hitzones, etc… If I have to access the character sprite everytime I need to use physics, it will complexify the code.

There is currently another active thread called Phaser on Node.js and Yannick example is actually doing what I want since the physics has been separated of the rendering. In this case, it is because the first one has to be done server side while the other one is done client side, but the result is the same.

For the physics part, the player class extends Phaser.Physics.Arcade.Sprite and no texture is sent to the constructor.

For the rendering part, the player class extends Phaser.GameObjects.Sprite.

Would that work for you? At least, the two game objects would be related, one having the physics and the other one no. But is it correct to create an arcade sprite with no texture?

In my mind, the character wouldn’t even be aware of its sprite. I was thinking of setting up a controler class whose only purpose is to add/destroy the right sprite every time a character is added/destroyed and to even their coordinates.

I’m not sure it is clear, it is sometime hard to explain certain concepts in a foreign language.