Jump to content

Pinball Demo


CtlAltDel
 Share

Recommended Posts

Inspired by 2 earlier demos of pinball in phaser:

http://noben.org/pinball/ and https://github.com/georgiee/phaserpinball

 

I decided to try and give it a go myself for a first attempt at actually making something playable with Phaser.

 

There are no graphics used other than those I coded myself using bitmapdata, I am no artist, but I can code my way around graphics :) Hence the blueprint style. The sounds are all from freesounds.org etc.

 

The whole thing is driven by p2 physics with revoluteconstraints for the flippers and extra restitution for the bumpers.

 

The 'game' is currently pretty boring and over quickly, but I'll probably add more elements in the future.

 

Try it here: Pinball

 

Enjoy, and comments welcome.

 

P.S. I tried programmatically adding a polygon for the flippers but failed horribly, for some reason it kept moving the polygon around as if it tried to keep the center of mass on the center of the polygon? Anyone have any experience with that?

 

Link to comment
Share on other sites

Hey,

nice demo! But it's scary to see so many raw canvas drawings. I hope you did not waste any time on creating them- just so see what shape looks best? You would be faster in photoshop or any other pixel editor.

I can also see in the source that you're adding a lot of circles and rectangles to the body to create the polygon. Is that the consequence of your described problem with the polygon? I can ensure you, there is absolutely no problem in using polygons with joints with P2. It must be a problem in the way you created them ? Do you have an example ?

I always create my physics in PhysicsEditor, export them with the phaser exporter and import them with Phaser.Physics.P2.Body#addPhaserPolygon.

There was a mass center bug with the default import method Phaser.Physics.P2.Body#loadPolygon (https://github.com/photonstorm/phaser/pull/749). Maybe this is causing your bug?

 

My Pinball Game, which I started to implement with the second mentioned link above is still in progress. I hope I can soon share the completed project with you. The Pinball game will include different table styles, a ramp, many lights and lightning patterns, ten different missions to complete, a central LED Display with a lot of commentary animations of what's happening on the table and a large rails backend to save scores, achievements, managing the fb integration, highscores and support for guest accounts. It's a client project, not a game to be sold, so I hope can release it as an open source project for you guys! If not I will mince it small enough so I can still share it with you ;)

 

Regarding a ramp, maybe that's the next step you could try in your project? It was one of the most frightening things during my preparations but it was a little bit easier than expected! I explained what I've done in this thread http://www.html5gamedevs.com/topic/4969-collision-on-different-heights-z-depth-in-a-top-down-view-game-pinball/?hl=pinball

 

Happy physics!

Regards George

Link to comment
Share on other sites

I am quite fluent in that sort of drawings. I develop software for CNC cutting tables etc, so drawing programmatically is second nature to me. I absolute suck at using photoshop, gimp or any other drawing tool. 

 

I will give the polygons another go or create a small example of the problem when I fail. I guess I should use the dev branch of phaser for testing since that center of mass thing. What happened with a simple triangle on the flippers was that if I moved one point the 2 others would move as well. 

 

Your ramp solution looks cool. My first next step is a launcher though. and some regular walls. I have some collapsable targets planned as well.

 

This is my first Phaser project, so I'm taking it in small steps.

 

Regards,

 

Wouter

Link to comment
Share on other sites

Well, now I understand why you did this. I think you will have lot fun with the physics. But when you start working on the logic part I really, really advise you to create some kind of finite state machine per element. This helped me so much to keep everything sorted. Good luck with your pinball. I think it's a great project to get started with Phaser. Keep us updated with your progress!

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