Jump to content

Phaser 3 "player.alive" returns undefined


lapamplamouse
 Share

Recommended Posts

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);
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...