shmellyorc Posted May 15, 2015 Share Posted May 15, 2015 I am having issues making webstorm to work with phaser.io. I have made an empty project, created an html5 (index.html) file. I added the phaser.js and app.ts (basically app.js) to the index.html. I also added the ts files for phaser to work in typescript (phaser.d.ts, pixi.d.ts, and so on). When I try to edit app.ts, it says it cannot find phaser.js but it finds phaser.d.ts fine. When i load it anyways, it cannot find package.json. I know my typescript is working properly because it generates an js file where the ts file is located. How do i make phaser to work with webstorm? I have looked on the part for webstorm section and it only has a little blerp about webstorm is a good choice for phaser. I want to get into phaser.io game development but I cannot because I have no idea how to make it work. I looked online for videos and their was one but he didn't really show how to add phaser to webstorm properly. Any help on this would be helpful. -Shmelly Link to comment Share on other sites More sharing options...
yahiko Posted May 15, 2015 Share Posted May 15, 2015 Please post the code of your index.html file Link to comment Share on other sites More sharing options...
shmellyorc Posted May 15, 2015 Author Share Posted May 15, 2015 index.html:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <script src="src/lib/phaser.js" type="text/javascript"></script> <script src="src/app.js" type="text/javascript"></script></head><body> <div id="content"></div></body></html>App.ts (basically app.js):module Game { export class SlashyDwarfGame { game: Phaser.Game; constructor(){ this.game = new Phaser.Game(800,600,Phaser.AUTO, 'content', { preload: this.preload, create: this.create }); } preload(){ } create(){ } }}file structure: http://gyazo.com/6f3240e5339e8f9ac189c83d5e568a58 Link to comment Share on other sites More sharing options...
shmellyorc Posted May 15, 2015 Author Share Posted May 15, 2015 also: http://gyazo.com/bd67efab5e14c5c5349035334ba34d59 Link to comment Share on other sites More sharing options...
Softmixt Posted August 5, 2016 Share Posted August 5, 2016 Add this line: /// <reference path="lib/phaser.d.ts"/> on your head app.ts file : /// <reference path="lib/phaser.d.ts"/> module Game { export class GameClass { game: Phaser.Game; constructor() { this.game = new Phaser.Game( 1280, 720, Phaser.AUTO, 'content', { create: this.create, preload: this.preload } ); } preload() { } create() { } } } window.onload = () => { var game = new Game.GameClass(); }; Link to comment Share on other sites More sharing options...
Recommended Posts