Realistic Pinball Physics With Demo
Ok so I have been pulling my hair out for a month working on a realistic pinball sandbox game that will allow users to design their own pinball games and share them with their friends.
The problems have been many and examples in tutorials suck because there are many factors such as size of collision box and objects in vicinity of a ball that affects physics.
I finally got the settings right for my game and the paddles have a very realistic feel and you can stall the ball, dribble the ball, pass the ball from one flipper to the other just like in a real pinball game.
Here are the settings I use however like I said there are many factors that will affect physics so you may need to adjust settings and change the collision box and impulse points for your specific game but this is the way it works.
First create a ball sprite and set the collision box to object:
Then set the ball physics:
Then create a paddle with a collision box set to the paddle object and two points for joints and impulse.
Paddle origin point:
Paddle Hinge (revolute joint) point:
Paddle impulse point:
Set the paddle physics.
Create a sprite box to anchor the flippers to and keep it small and center the origin point.
Physics setting for joint box:
Now place your joint box and flippers on your layout where you want them to appear. The flippers will automatically attach to the joint box origin point after we set the events and run the game.
create some outside boundaries so the ball bounces off the walls:
Just use a filled box for a sprite and and set the physics.
Create a bumper bell object. A filled circle with centered origin point and set the physics.
NOTICE: the Elasticity is set to 1 or higher for objects you want the ball to bounce off of at a faster speed.
REMEMBER- everything in a game using physics must have a physics behavior to interact or strange and terrible things will happen.
Your objects should look something like this now.
Now here are the events:
Open full size image
Run the layout and if you did everything correctly you should be able to control the flippers very accurately with the arrow keys. If objects are falling down it is because you didn't set them to immovable. Only the paddle and ball is movable and allowed to rotate.
That is the exact events and settings used in my game design below and I am just using fancy graphics and some whiz bangs and special affects but the physics are pretty simple once you understand how objects in the real world react with other objects.
Bookmark my Demo and you can watch as I progress on the game and I will update with how to make a variable speed ball plunger later.
Enjoy and leave any questions and feedback in the comments!
Unlock your full gamedev potential
Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!
Plus, it's got a lot of additional features that will help you save time and make more impressive games!