Pinball plunger!

Get help using Construct 2

Post » Wed Nov 09, 2016 9:15 pm

Does anyone have any ideas how I can simulate the action of a pinball plunger in a physics based environment???????
B
17
S
6
G
1
Posts: 83
Reputation: 1,895

Post » Wed Nov 09, 2016 11:43 pm

You could give the plunger a "Drag & Drop" behaviour, set to "vertical". Also, give it a instance variable, "initialY" for example.
When drag starts, set "initialY" to its current Y.
When the dragging ends, apply an impulse to the pinball with the force of the dragged distance to the pinball (distance(plunger.x,plunger.y,plunger.x,plunger.initialY)).
Under the same event, reset the plunger to its initialY and enable physics again.

Sorry if not everything is clear, I don't have C2 available atm, but if you want, I can create a .capx for you later.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Thu Nov 10, 2016 1:39 am

Thanks randomly. I will give your idea a try!

I couldn't work it out - a capx would be great!
B
17
S
6
G
1
Posts: 83
Reputation: 1,895

Post » Thu Nov 10, 2016 8:37 am

If you search you should find a few examples, and there is also the following tutorial which may be of some use:

https://www.scirra.com/tutorials/207/pinball-physics-to-the-max
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
86
Posts: 5,422
Reputation: 59,530

Post » Thu Nov 10, 2016 3:02 pm

Well, I guess you won't need a .capx anymore.
Just look at the 3rd page of the tutorial that @zenox98 posted.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Thu Nov 10, 2016 7:07 pm

Cheers for the info folks, but I think the method suggested by @randomly would work best! I will have a bit of a play around to see if I can get something similar! Don't hold your breath though...
B
17
S
6
G
1
Posts: 83
Reputation: 1,895


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests