Closed ArnaudDroxler closed 4 years ago
Hi @ArnaudDroxler
What file are you loading in the pack file, the .js
file, or the .ts
file?
The browser founds a syntax error. At a glance I don't see any syntax error in your TypeScript.
Hi
I load the .ts file pack file, by default it was the .js but nothing show in th screen so y change it. I think i miss something about how typescript works in PhaserEditor.
You cannot load the TypeScript file, the browser does not understand it. You should load the JavaScript file. If it shows an error please paste it here, I can help you.
Okay, actually, it was dumb. So I try to create a new project, import some assets, and add some to the scene. But if I play the game, nothing shows up, all my modification is generated in the .ts file and there is nothing in the .js file. So how in to compile the .ts file into the .js file automatically.
Hi,
You can run the typescript compiler in watch mode:
https://stackoverflow.com/questions/12799237/how-to-watch-and-compile-all-typescript-sources
$ cd /path/to/ptoject/WebContent
$ tsc -w
You can do this with the Windows CMD or using the Terminal view in Phaser Editor (Ctrl+3
search for Terminal view).
Hi,
Thank you for the response, it’s working great now. I thought that the phaser editor will directly compile ts into js.
Great.
Version
Description
I am quite new to the phaser environment, and I was testing Phaser editor with typescript. I have an issue with properties in scene class. If y use the button for assigning a property on an object in scene or declare a simple string as a class fields. The game load an empty scene at play and show an error in the browser console Uncaught SyntaxError: Unexpected identifier
I am sure that I miss something but I don’t understand why.