I am trying to add phaser 3 games to my ionic 4 application using this method found on github (https://github.com/write2sv/ionic4-phaser3-template/commits/master).
This means rewriting my games in typescript, and some other changes. one big issue I am coming across is defining my player as alive which is the first if statement in my update(). it just returns undefined and I do not understand why. Can anyone help me on how to get around this??
Here is how I define my player:
player = this.physics.add.sprite(window.innerWidth / 2, window.innerHeight - 100, 'ship');
player.setOrigin(.5, .5);
//this.physics.enable(player, Phaser.Physics.Arcade);
player.physicsBodyType = Phaser.Physics.Arcade;
I have tried using .enable but I get the following error :“Property ‘enable’ does not exist on type ‘ArcadePhysics’”
Another possible cause:
I get the following error with startSystem “Property ‘startSystem’ does not exist on type ‘ArcadePhysics’.” by adding a physics sprite I thought I would get around both these error’s but no
this.physics.startSystem(Phaser.Physics.Arcade);