mikewesthad / phaser-matter-collision-plugin

A plugin for making it easier to manage collisions with Phaser 3 + Matter.js
MIT License
99 stars 8 forks source link

TypeError: Cannot destructure property 'START' of 'phaser__WEBPACK_IMPORTED_MODULE_0__.Scenes.Events' as it is undefined #7

Closed frey123 closed 2 years ago

frey123 commented 2 years ago

I am importing the plugin as script and get the following error:

TypeError: Cannot destructure property 'START' of 'phaser__WEBPACK_IMPORTED_MODULE_0__.Scenes.Events' as it is undefined

It worked several days before and fails without changing anything.

It can be reproduced in the following example from your blog post "Modular Game Worlds in Phaser 3": https://mikewesthad.github.io/phaser-3-tilemap-blog-posts/post-5/04-platformer-step-2/

Best

mikewesthad commented 2 years ago

@frey123 Thanks for reporting this! Will look into it today.

mikewesthad commented 2 years ago

After looking into it, the root issue is that Phaser has had some massive updates in last couple years (especially v3.50). The example you link is using a 2+ year old beta version of Phaser.

For anyone who needs to use an older version of Phaser, they can use an older version of Phaser Matter Collision Plugin, e.g. you can grab 0.10.2 via jsdelivr via:

https://cdn.jsdelivr.net/npm/phaser-matter-collision-plugin@0.10.2/dist/phaser-matter-collision-plugin.min.js

I'll update the readme (and the blog posts) to point out this compatibility info.