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

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • 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!

  • No problem! For me it's good experience learning my way around the engine anyway Best of luck with your game!

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