How to build a simple game in the browser with Phaser 3 and TypeScript

How to build a simple game in the browser with Phaser 3 and TypeScript
0

by Mariya Davydova

I’m a developer advocate and a backend developer, and my frontend development expertise is relatively weak. A while ago I wanted to have some fun and make a game in a browser; I chose Phaser 3 as a framework (it looks quite popular these days) and TypeScript as a language (because I prefer static typing over dynamic). It turned out that you need to do some boring stuff to make it all work, so I wrote this tutorial to help the other people like me get started faster.


This is a companion discussion topic for the original entry at https://www.freecodecamp.org/news/how-to-build-a-simple-game-in-the-browser-with-phaser-3-and-typescript-bdc94719135/

Everything works fine, but in my app.ts, the console reads:

Cannot find name 'GameConfig',

for both instances of GameConfig.

The game runs properly and It’s doing what I want, but I feel like I’m missing something important.

Awesome post, really informative, however when i run ‘npm start’ the game doesnt open in browser, any suggestions?

did you use npm build first? make sure you have your webpack.config and package.json setup properly

Instead of GameConfig, use Phaser.Types.Core.GameConfig. No idea why this would be necessary, though.