Ubuntu: Visual Studio Code with MVC + Phaser = doesn't work?

Hey guys,
It’s my first time that I’m writing here so please be gentle if I incorrectly posted this topic.

I hope you can help or guide me in order to solve my problems. FYI, I really tried to sort this out myself, but I’m kind of desperate, thus my post…

The situation is that I have ubuntu, Visual Studio Code and the project is in MVC. I’ve tried with Phaser 2 (Phaser CE 2.13.1), so I do have the phaser.js, phaser.min.js, phaser.d.ts,pixi.d.ts and p2.d.ts. I’ve created a typescript.config file and a corresponding javascript-file (app.js) to my own created ts-file (app.ts).

Regarding the web server part, well Visual Studio Code or rather .netcore if I understood correctly uses Kestrel (?) and I can see it being called by Program.cs. I guess that solves the web server issue?

I am new to Phaser, and I tried the typescript-tutorial

The problem with the tutorial is that it assumes the user to have Microsoft Windows and creates a project called “HTML with typescript”, so it doesn’t match my specific situation.

When running the application all I’m getting is a blackscreen when loading the page… the excpected result is a png-file through Phaser…

Do any of you have experience with how to set up phaser with visual studio code with a projectsetup of MVC, in Ubuntu?

When I ran the debugger, the only solid “bugg” I’ve found was this:
ReferenceError: window is not defined

It was reffering to this line of code in app.ts (I’ve used from the typescript-tutorial)
window.onload = function () {
var game = new SimpleGame();
};

Well, I’m desperate and I really don’t want try to reinvent the many fantastic wheels such as collision-handling etc you guys have created with Phaser, with only pure javascript… ain’t gonna work.

My goal is to create many mini-games, such space ship, run & gun, etc…

Looking forward to your help and guidance
Best regards
Eclip

Without seeing your actual setup, there are a few things that could be going wrong. How is your Typescript being built (I have not done that tutorial before)? Are you referencing the built Javascript files in the Razor view you are returning in MVC? They are possibly in a /build folder once your Typescript has been compiled, but this is configurable in your .tsconfig file. Of course you can’t reference any TS files directly in the browser.

Hey @Jackolantern!
Tank u for the reply !
Whats the best preferable way to share my code-setup?
I will happily do it in order to get Phaser running :slight_smile:

BR
Eclip

  1. There is a difference between Visual Studio Code and Visual Studio. Which one are you using?

  2. go to Github and find a template instead. It’ll make your life very simple.

example: https://github.com/rroylance/phaser-ce-npm-webpack-typescript-starter-project

Good luck!