CtlAltDel Posted April 26, 2014 Share Posted April 26, 2014 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 More sharing options...
jerome Posted April 26, 2014 Share Posted April 26, 2014 ImpressiveWho could image such things could be done with phaser only 6 months ago ? Link to comment Share on other sites More sharing options...
george Posted April 26, 2014 Share Posted April 26, 2014 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 Mike 1 Link to comment Share on other sites More sharing options...
CtlAltDel Posted April 27, 2014 Author Share Posted April 27, 2014 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 More sharing options...
george Posted April 27, 2014 Share Posted April 27, 2014 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 More sharing options...
nExt Posted April 27, 2014 Share Posted April 27, 2014 good Link to comment Share on other sites More sharing options...
CtlAltDel Posted April 27, 2014 Author Share Posted April 27, 2014 I added a fairly realistic launcher based on a spring constraint. Kind of hard to get the correct amount of thrust and springyness without making the ball fall through the launcher. Link to comment Share on other sites More sharing options...
jpdev Posted April 27, 2014 Share Posted April 27, 2014 Cool .. but more boundaries please It's like playing a flipper where the casing has been removed at the moment. Link to comment Share on other sites More sharing options...
CtlAltDel Posted April 27, 2014 Author Share Posted April 27, 2014 hehe, bounderies are something I am struggling with atm due to the addPolygon function being kinda broken with regards to center of mass and having to hack around it. Link to comment Share on other sites More sharing options...
enriqueto Posted April 27, 2014 Share Posted April 27, 2014 cool! I am currently working on something similar Link to comment Share on other sites More sharing options...
totor Posted April 28, 2014 Share Posted April 28, 2014 i love the art style, do you have any links, tutorials to draw programmatically and still looking good? Link to comment Share on other sites More sharing options...
CtlAltDel Posted April 28, 2014 Author Share Posted April 28, 2014 Just images.google.com and search for blueprints, then try and get a minimalistic topdown view of the shape. Sketch on paper, then program using math and magic Link to comment Share on other sites More sharing options...
totor Posted April 28, 2014 Share Posted April 28, 2014 that's precisely the math and magic part i'm interested in Link to comment Share on other sites More sharing options...
Recommended Posts