Jump to content

Phaser 3 Pinball mechanics


Recommended Posts

Hello all!

I'm new to Phaser and trying to create my first game using Phaser 3 and Matterjs.  I'm trying to create a simple pinball game but I'm having some trouble with the flippers.
I've started by trying to modify the Circular Body example (http://labs.phaser.io/view.html?src=src\physics\matterjs\circular body.js). I'm trying to use the ground like a singular flipper.

The example has the ground/flipper set to static which I don't think is right for my purpose.  I've looked at some phaser/p2 stuff and it looks like some people have made flippers by setting the mass to 9999, gravity to 0. Is this the best way to create a flipper or does Phaser 3/Matterjs have a different way of creating this effect?

Thanks for your help!

Link to comment
Share on other sites

10 hours ago, Befive.Info said:

I am curious about it too but I am on something else right at this moment.

Did you have a look at this codepen which uses matter js? https://codepen.io/lonekorean/pen/KXLrVX?editors=0010

No I hadn't seen that. I'll check it out!

6 hours ago, GreenCloversGuy said:

I'm not great with Matterjs, however I believe you want to use constraints to create a Constraint of size 0? I don't know how to use constaints in Phaser 3, but you can see an example in put MatterJS here. 


After some more research I found constraints and that's what I'm currently using.
I've got the constraint to attach to the side but the flipper spins about 180 degrees when the page loads before the air friction brings it to a stop, I'm not sure why it's trying to initially spin.

Here's the code i'm using,

flipper = this.matter.add.image(400, 400, 'flipper');
this.matter.add.worldConstraint(flipper, 0, 0, {
			pointA: { x: 210, y: 800 }, 
			pointB: { x: -25, y: 0 }


Link to comment
Share on other sites


  • Recently Browsing   0 members

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