Jump to content

Need active elements for pinball game using P2 physics


n-vision
 Share

Recommended Posts

Hi,

1 month ago, I started looking into physics coz  I've wanted to make a pinball game
(I own 5 real games and am a bit of Pinball freak).

So I started looking at physics, which I never had used before (I made some other Phaser games before)
Anyway, P2 seemed good enough and I also found this demo by forum member george : http://georgiee.github.io/phaserpinball/

So I worked from that and I now have this :  http://n-vision.nl/games/pinball/
 

Still a work in progress, but It plays quite nicely I think..
What I would like to add is *active* elements that not just bounce the ball back, but kick it back when hit.
I can register a hit and then need the bumpers and slingshots to kick the ball away (on top of the bounce)

What would be the best way to achieve this ? I tried using body,reverse but that is producing strange effects..
I can think of these options :

  • always apply the same restitution value for bumpers and slingshots (so not dependent on speed of ball) - but that's probably not possible
  • create a virtual kicker using P2 that kicks the ball (seems pretty hard to do for a bumper because it's a circle that can be hit from any direction)
  • create a reverse force for the pinball

Anyone has any ideas or pointers ?

Besides this - would box2d be better for pinball then P2 ?

thanks for any input or feedback.

 

pinball.jpg

Link to comment
Share on other sites

well, wouldn't you know it..
the version that was online had a weird shift in the geometry that caused all kinds of problems with the ball flow - ofcourse this only  happened when I decided to post to the forum :-(
it's now fixed (version should be 0.71b or higher)

if you tried it before - please try again :-/

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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