(P 3.80.1, PE 4.3.0, Webpack, Typescript)
I created a scene with Phaser Editor (PE). The essence of PE is that you basically create the scene on a graphical user interface. PE then compiles a document that can be handled by the Phaser framework on the fly after saving the document. That’s why a scene in this workflow always consists of two documents (“.scene” and “.ts”).
Firstly, PE’s own document, which describes the scene for PE. This should not be touched at any rate.
The second document is created/changed by PE from the editor the moment you save the scene in the editor.
The key feature of this document is that there are areas that are reserved for PE; these areas should not actually be changed by the programmer. Other areas, on the other hand, are specially marked and can be filled with the programmer’s own code.
I strictly need different scenes in the game to be assigned to different physics systems (Arcade or Matter), which I registered of cause both in the “index.ts”, arcade as default.
to activate Matter I inject code in the samescene.ts file within the constructor() section:
super({
key: “Poc08”,
physics: {
// Enabling Matter physics for this scene
matter: {
gravity: {
x: 0,
y: 1 // or any gravity setting you prefer
},
debug: false // Set to false if you don’t want debug lines
}
}
});
Additionally I comment the PE compiled code “super(“Poc08”);” with"//".
The problem now is that everytime I’m changing something in the scene with PE and save the scene my comment is reversed by the PE compiler ending up with an error. So my workaround is, after saving the PD scene, I re-comment manually the respective line and everything work nice and smooth.
Ist there a possibility to prevent this manual retouching, e. g. with a PE user component or similar?
On a broader scale: Is it possible to establish PE user components with the PE component editor which assign Matter behaviour to objacts/images etc.?
Thx 4 help!