SeaMonster11 Posted June 2, 2013 Share Posted June 2, 2013 Hi,can someone help me in start with Phaser? I've read some tutorials, but Phaser still don't want to work. I have 3 files. First is "index.ts":/// <reference path="../phaser/phaser/Phaser/Game.ts" />(function () { var myGame = new Phaser.Game(this, 'game', 800, 480, init, create, update, render); function init() { myGame.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL; } function create() { } function update() { } function render() { myGame.stage.context.fillStyle = 'rgb(255,0,0)'; myGame.stage.context.font = 'bold 58px Arial'; myGame.stage.context.fillText(Phaser.VERSION + " works!", myGame.stage.centerX - 120, myGame.stage.centerY); }})();I compile this by command "tsc index.ts --target ES5" and I get the file "index.js".I've one more file, "index.html":<!DOCTYPE html><html><head> <meta charset="utf-8" /> <title>heu heu</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="index.js"></script></head><body></body></html> That's all. When I open the html file, I see only white background. What's wrong with my code ? Link to comment Share on other sites More sharing options...
rich Posted June 2, 2013 Share Posted June 2, 2013 There are 2 things you can do: 1) Include the phaser.js file in your html file 2) If you want just one single JS output file then change the command-line you're using to this: tsc index.ts --out game.js --target ES5And it will compile the whole of Phaser + your index.ts file into game.js Link to comment Share on other sites More sharing options...
SeaMonster11 Posted June 3, 2013 Author Share Posted June 3, 2013 Thank you very much! Link to comment Share on other sites More sharing options...
Recommended Posts