Applying Physics to Upwards Moving Platform

0 favourites
  • 8 posts
From the Asset Store
A pack of 76 platform designs for a platformer game with a mushroom/jungle theme
  • Hi everyone,

    Just started with Construct 2 yesterday and love it so far. I am trying to replicate some functionality in a game I started in another engine and I am somewhat puzzled by what I must be doing incorrectly. I have used the search, went through the stickies and re-read the physics tutorials; still no luck.

    I have blocks falling from the top of the screen using the Physics and Bound to Layout behaviours (the later to prevent them from leaving the play area.

    Moving upwards from the bottom of the screen, there is a platform that also has the Physics behaviour attached to it. To get the movement upwards, I am using an Event on every tick to set the Y-axis value to the current value - 2.

    When I start the simulation, the blocks hit the platform, there are some minor bounces as expected based on the restitution values and then they stop while the platform moves through them. Once the platform moves through them the blocks fall off the bottom of the screen.

    The Problem: As you can probably imagine, I need the blocks to sit on the platform and move upwards with it. Is it because I am manually setting the Y-axis value on the platform? Is there an option that could perhaps change the platform so it 'floats' upwards?

    Thanks for your assistance!

  • Okay, I did a few more searches and found a great post that led me to the applying of upwards force on my platform at a value of 75 (against the default world gravity of 10), X=0, Y=0, image point=0.

    So I now have a new problem in that the platform is moving upwards relatively quickly in an uncontrolled manner; the platform shifts from side to side. Quite hilarious but I need some control as I want to it to move straight up while still employing physics against the blocks.

    Any ideas?

  • Okay, came up with an idea that seems to work a bit better than what I had but it still seems jerky.

    Since I am building this for a mobile device, I made the platform the exact width of the screen and then constrained to to the layout. I still have the force being applied upwards as per a post that Ashley made last month (http://www.scirra.com/forum/somethings-id-like-to-see_topic44932.html) so my only real issue now is that the blocks seem like they are shaking. If I recall correctly that could be due to some tweaking of the Box2D values (friction or something) so I will take a look at that.

    Wow! I love how you can work through a number of tweaks in such a short time frame.

  • Sigh. As I continue to work on this I am running into a second issue along with the shaking blocks. It seems that they all start to slide to the left side of the screen. Is that because the platform is not 100% level???

  • After some messing around I managed to fix this on my own by trial and error (sometimes the best way to learn a new tool). I was applying force but that gave me some really odd artifacts (read above) so I instead just applied upwards (negative Y) velocity against the platform and it seems to work much better. There is still a bit of shake in the blocks as they land on the platform but I think that should be relatively easy to tweak.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have ran into another issue...

    As more blocks fall onto the platform, they start to add more and more weight onto my platform to the point where the velocity I have applied against it to move it upwards, stalls and it comes crashing down to the bottom of the screen.

    Does anyone know how I can keep it moving upwards regardless of how many blocks (adding additional weight) fall onto it?

    Thanks!

  • Hi PixelAmp!

    Can you provide a capx of the project? It would be a lot easier to assist you if we can see what is going on ourselves.

    You can use DropBox if you need a file host.

  • Thanks for the reply Wastrel!

    I managed to get it working. For those that are interested, I totally made a boneheaded move... LOL!

    Since the blocks were forcing the platform downwards, I neglected to check the density field for the platform. I increased it to 99 and that seems to have resolved it.

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