Phaser 3 ionic 4 integration

Hi there,

Has anybody managed to integrate phaser 3 to ionic 4? I created a blank project then

I included the phaser.js to index.html by

<script src="assets/phaser/phaser.js"></script>

and tried to get access to Phaser at home.page.ts by

declare let Phaser;

However, I get “Cannot get namespace Phaser” error. I believe I need to include at the top of home.page.ts

/// <reference path=”phaser.d.ts”/>

But that throws

invalid reference directive syntax

I believe the reference syntax require “typescript 3.5.1” but not sure about the implications of upgrading regarding ionic

I might be doing this the wrong way as I am not very knowledgeable about all this so I’d appreciate any pointers you might have.

Thanks,

Doug

It looks like you should be able to install it through npm and it comes with it’s own typings.

2 Likes

Many thanks Chris, appreciate the response

Hi guys, I have a problem with phaser in the preload, and soo shows the buttons I need for the game.

I am having the similar issue. Getting a blank screen when I run ionic serve

This is the code I am running.

1 Like