Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matter - gameObject.emit is not a function #4967

Closed
reinildo opened this issue Jan 24, 2020 · 15 comments
Closed

Matter - gameObject.emit is not a function #4967

reinildo opened this issue Jan 24, 2020 · 15 comments

Comments

@reinildo
Copy link

On Phaser 3 matterJs examples, like this one: http://labs.phaser.io/view.html?src=src\game%20objects\tilemap\collision\matter%20platformer%20with%20wall%20jumping.js
, when thow bodies collides we receive this error: i.gameObject.emit is not a function

Looking on the source code file: MatterCollisionEvents.js

if (bodyA.gameObject) {
  // bodyA.gameObject.emit('collide', bodyA, bodyB, pair)
      matter.Events.trigger('collide', bodyA, bodyB, pair)
 }

if I replace the commented line with code below it works without error.
Is it an issue or am I doing something wrong?

Thanks

@photonstorm
Copy link
Collaborator

It depends what the Game Object is. If it's a Sprite, Image, TileSprite, etc, then emit will work fine, as they have Event Emitters by default. If it's a Matter.Tile then it won't, as we never give individual tiles emitters.

@reinildo
Copy link
Author

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

@Hetachi
Copy link

Hetachi commented Feb 4, 2020

What was the fix? What version is the last that did not have this bug?
I am on 3.15 and I got this error too.

@photonstorm
Copy link
Collaborator

It's impossible for 3.15 to have this error, as it came about as a result of a brand new plugin added in 3.22. The fix is for 3.23, which isn't published yet.

@Hetachi
Copy link

Hetachi commented Feb 5, 2020

It's impossible for 3.15 to have this error, as it came about as a result of a brand new plugin added in 3.22. The fix is for 3.23, which isn't published yet.

Awesome thanks for the info, any eta on 3.23 ?

@Brandoning
Copy link

Any update on when 3.23 will be released? I am experiencing this bug

@Hetachi
Copy link

Hetachi commented Mar 10, 2020

Any update on when 3.23 will be released? I am experiencing this bug

As far as I know the update is supposed to be released sometime in April, there was a news blog posted about it, not sure if it was just for patrons or not.

You can use the master branch its quite stable and has a fix for it already.

@embeddedt
Copy link

Is there a timeline for when 3.23.0-beta1 will be published to NPM? At the moment I'm using a manually built version of Phaser which works but makes it harder to use typings (as it's not installed in node_modules).

@Brandoning
Copy link

I'm using 3.23-beta1 and I still seem to be getting this issue? Unless I modify the code to matter.Events.trigger it'll error

@embeddedt
Copy link

@Brandoning What type of game object is it? #4967 (comment)

@Brandoning
Copy link

@embeddedt it's a Phaser.Physics.Matter.Sprite

@embeddedt
Copy link

embeddedt commented Apr 24, 2020

That's strange. I also use sprites in my game that collide with each other and I don't have this problem with 3.23-beta1.

This is the Phaser minified JS file I'm using (compiled from 7fbe57c last week).

@starikcetin
Copy link

starikcetin commented Apr 25, 2020

Where can I get the 3.23-beta* versions? They are not on the npm and there is no git tag that includes 3.23.

Edit: I managed to do npm i https://github.com/photonstorm/phaser/tarball/master which installs the master branch directly. You can also use tags there but as I mentioned, there are no tags for 3.23 at the moment. (ref: https://stackoverflow.com/a/32436218/6301627)

@embeddedt
Copy link

Yes; you have to manually clone the master branch and build it. Nothing has been tagged yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants