Jump to content

Updating a phaser 2 project to phaser 3


lapamplamouse
 Share

Recommended Posts

I am trying to put all my phaser 3 games into one ionic 4 application. I found the following example which works perfectly for phaser 2 (https://store.enappd.com/product/ionic-phaser-game-framework-ionic-4/). however when I try to update to phaser three the screen goes blank. I imagine one of the problems is to do with how scenes have replaced states. does anyone have any ideas how to get around this or is this example workable anymore??

below is some code

 

        export class HomePage {

             constructor(private menuCtrl: MenuController) {

                 game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, 'space- invaders',

                 { preload: this.preload, create: this.create, update: this.update, render: this.render }

             );

        that = Object.create(this.constructor.prototype);

       } preload() {

             this.load.image('bullet', 'assets/phaser/bullet.png');

            game.load.image('enemyBullet', 'assets/phaser/enemy-bullet.png');

      }

      }

 

game.load works for phaser 2, if I use this.load in ionic it throws the following error ‘Property ‘load’ does not exist on type ‘HomePage’.’

With these changes to phaser is this method even possible??

 

 

 

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...