How do I balance a stack of plates/stick on a moving box?

Get help using Construct 2

Post » Sat Jan 21, 2017 6:29 pm

Say that the player controls a box or a hand at the bottom of the screen and there is a very long narrow stick or a stack of plates balanced on the box. The stick begins to lean and the player has to move left or right with the mouse to correct it so that it doesn't fall. If you've ever held a broom upside down and tried to balance it in your palm it would be the same idea.

I started off trying to use physics but I kept getting out of control bouncing or very unpredictable interactions. I would rather be able to do it with physics rather than coding everything manually (every tick, add 1 to stick speed, adjust angle X pixels, etc, unless player moves Y pixels, then adjust stick by Z pixels, etc), but even knowing the basic idea I have no idea where to start, as all my events so far have no produced anything useful.
B
24
S
6
G
1
Posts: 47
Reputation: 1,894

Post » Sat Jan 21, 2017 8:39 pm

If you're having issues with objects bouncing off one another, you may need to change the elasticity of them.

Select the object under the projects bar, then off to the left of the screen there should be some physics parameters. A lower elasticity will keep it from bouncing.

Sorry if you've already tried that, it just seemed like maybe the most obvious problem to me.
B
16
S
5
Posts: 7
Reputation: 1,022

Post » Sat Jan 21, 2017 9:01 pm

It just occurred to me that your other issue might be, if you're using something like a stick and you want it to be unstable on a flat surface, you might want to make the collision for the bottom portion somewhat rounded off, so that there isn't a surface totally parallel where the object could be balanced.
B
16
S
5
Posts: 7
Reputation: 1,022

Post » Sat Jan 21, 2017 9:23 pm

Here's a little demo I made, it's not perfect but has the functionality you're going for, I think.

https://drive.google.com/file/d/0B2F_Vc ... sp=sharing

Let me know if that link doesn't work and I'll upload to dropbox, left click inside the blue box to start, right click to reset.
B
16
S
5
Posts: 7
Reputation: 1,022

Post » Tue Jan 24, 2017 1:16 am

Yes! Your capx was beautifully done. I don't know why I had such trouble with it. I had previously played with the physics properties but couldn't quite get it going. Thank you so much for this well-made example!
B
24
S
6
G
1
Posts: 47
Reputation: 1,894

Post » Tue Jan 24, 2017 5:41 am

No problem! For me it's good experience learning my way around the engine anyway :D Best of luck with your game!
B
16
S
5
Posts: 7
Reputation: 1,022


Return to How do I....?

Who is online

Users browsing this forum: dop2000, MrQuickGame and 31 guests