[EDIT] Pinball Problems

0 favourites
  • 6 posts
From the Asset Store
A classic pinball game with an interesting twist!
  • Hello,

    I was trying out some ideas by making a quick pinball game. I made the paddles rotate by placing the origin point where I wanted it, and the paddles rotate between angles correctly. So far, so good.

    However, when I add physics to them so they can interact with the ball and set them as immobile (as I do not wish them to fall), they seem to rotate around a middle point, rather than the origin. I there a way to fix this?

  • You shouldn't ever use immoble for anykind of moving physics object. If you force an immoble object to move. It's likely the physics results won't occur very well. "immobile" is meant for static objects.

    I would suggest instead adding a limited revolute joint to the paddles instead.

    and finally. i don't see a lot of good things coming from using physics. I would suggest using bullet behaviour on the ball. then when a paddle hits the ball just adding extra force to the balls speedl

  • Great, thanks! I'll play around with those solutions and see what works.

    This is the first time I played around with physics... It was trickier than I expected.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • There was an old Tutorial of making pinball game with physics, but unfortunately the files seem to be missing.

  • Cheers, having a look at it now!

    *EDIT

    Had a look and the missing CAPX is a real bummer. I think I'll be playing with it without physics on the ball and paddles.

  • Have ditched physics almost entirely, at least for the paddle and ball.

    My problem now is with the spring that launches the ball. I can't post links yet, so I'll do my best to explain the setup.

    The spring moves down by pressing the Down key. Each pixel adds 1 to its Movement instance variable.

    When the Down key is released, the spring reverts to its original position, the Bullet behavior is enabled on the Ball, which bounces off the spring. This launches the ball successfully.

    I've implemented a reset key for when the ball accelerates too much and goes through the level barriers. This puts the ball in its original place on top of the spring, disables the Bullet behavior and sets its Bullet speed and acceleration to 0.

    When I reset and relaunch the ball, it simply disappears off screen. If I reset it one more time and try to launch it again, I also get a big javascript error and the same thing happens.

    This is the error:

    Assertion failure: Bounce normal computed as NaN

    Stack trace:

    assert2@http://localhost:50000/preview_prelude.js:12

    Runtime.prototype.calculateSolidBounceAngle@http://localhost:50000/preview.js:3773

    Acts.prototype.Bounce@http://localhost:50000/Bullet_behavior.js:291

    Action.prototype.run_object@http://localhost:50000/eveng.js:1644

    EventBlock.prototype.run_actions_and_subevents@http://localhost:50000/eveng.js:850

    EventBlock.prototype.run@http://localhost:50000/eveng.js:807

    Runtime.prototype.executeSingleTrigger@http://localhost:50000/preview.js:3998

    Runtime.prototype.triggerOnSheetForTypeName@http://localhost:50000/preview.js:3917

    Runtime.prototype.triggerOnSheet@http://localhost:50000/preview.js:3850

    Runtime.prototype.trigger@http://localhost:50000/preview.js:3811

    instanceProto.onKeyUp@http://localhost:50000/Keyboard_plugin.js:130

    instanceProto.onCreate/<@http://localhost:50000/Keyboard_plugin.js:60

    x.event.dispatch@http://localhost:50000/jquery-2.0.0.min.js:4

    x.event.add/y.handle@http://localhost:50000/jquery-2.0.0.min.js:4

    Why doesn't it relaunch at the normal speed?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)