How do I push/pull objects smoothly?

0 favourites
From the Asset Store
Push the Box Puzzle Game likes Sokoban made with Illustrator
  • Hey, I want to make a platformer where the player can push and pull objects.

    I've used this method to push/pull objects.

    It works, but the object box seems fidget. is there a way to have it move smoothly?

  • Check your project settings, how big are the objects? Is pixel rounding on/off?

  • Hey, I want to make a platformer where the player can push and pull objects.

    I've used this method to push/pull objects.

    It works, but the object box seems fidget. is there a way to have it move smoothly?

    Check out Miu3's example below.

  • Check your project settings, how big are the objects? Is pixel rounding on/off?

    My project is 640 by 480 and pixel rounding is off.

    > Hey, I want to make a platformer where the player can push and pull objects.

    > I've used this method to push/pull objects.

    >

    >

    > It works, but the object box seems fidget. is there a way to have it move smoothly?

    >

    Check out Miu3's example below.

    I tried using that, however I want the player to be able to push/pull objects without any resistance. Is there a way for me to have plays pull/push objects without any resistance smoothly?

  • I thought Miu3's example was smooth enough?

    If it's the speed, then I would tweak the settings in event sheet that are currently set to 30 for push and 20 for pull.

  • When I adjusted the speed in the example it cause the objects to fidget as well. :/

  • I have found another thread with a capx example. This is not platform based, like the first one, but it seems its 8 direction method is pushing objects smoothly.

  • I have found another thread with a capx example. This is not platform based, like the first one, but it seems its 8 direction method is pushing objects smoothly.

    The downloads are no longer available.

  • > I have found another thread with a capx example. This is not platform based, like the first one, but it seems its 8 direction method is pushing objects smoothly.

    >

    > 4-way-push-pull-object-help_t82846

    >

    The downloads are no longer available. <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    This one was still available on that page. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    https://dl.dropboxusercontent.com/u/108 ... leBox.capx

  • >

    > > I have found another thread with a capx example. This is not platform based, like the first one, but it seems its 8 direction method is pushing objects smoothly.

    > >

    > > 4-way-push-pull-object-help_t82846

    > >

    >

    > The downloads are no longer available. <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad" />

    >

    This one was still available on that page. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green" />

    https://dl.dropboxusercontent.com/u/108 ... leBox.capx

    Thanks! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" /> I tried to implement it, but it still causes it to "fidget". I don't understand why since both the playerbox and objectbox have the same speed, acceleration and deceleration. It doesn't seem to be pushing the object correctly, it seems the object slightly bounces off the player box every pixel.

  • You're welcome, Justin64. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    How about a Grid based push?

    how-do-i-grid-move-and-push-object_t128467

    This is procrastinator's example from the thread

    https://dl.dropboxusercontent.com/u/666 ... shing.capx

  • Thanks! However I still prefer the platform styled pull/push since my game is a platform game. Would anybody know the potential cause of the block's "fidgeting"?

  • You're welcome, Justin64.

  • They fidget because the 'order' of things happening is wrong.

    I assume you made the blocks solid so you can jump on them.

    Now. In real life when you push a block, 2 things are happening. You make the block move, but it is the block that moves you. If the block is not moving, you are not moving. So in fact, it is the block that moves, and you (as a rigid body) just keeps the same distance.

    In C2 there is a lot more happening. First you collide with the block. You stop, not by keeping your distance, you stop by the given deceleration (in the property's). So, you shoot over, and collide again and again till you dont move. On each collision the platform behavior performs a 'push out of solids' algorithm. Also the block will collide and perform a 'push out of solids' algorithm. Meaning, things start to go a bit right when the deceleration is done and over with. Till then, the player is pushing it self to the wrong direction.

    I think (assuming that the player is not solid), that you should think the other way. Dont push, always pull. Make the block pull the player (what looks as the player pushing, make the player pull the block (what looks as the player pulling). In my head this makes sense, but guess i got to try it myself first.

    If the player now collides, with the intention to push, it is the block that moves first (actual pulling), and player (not holded up by a collission) just keep its distance.

    If the player now collides, with the intention to pull, it is the player that moves first, and the block is just following.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think (assuming that the player is not solid), that you should think the other way. Dont push, always pull. Make the block pull the player (what looks as the player pushing, make the player pull the block (what looks as the player pulling). In my head this makes sense, but guess i got to try it myself first.

    If the player now collides, with the intention to push, it is the block that moves first (actual pulling), and player (not holded up by a collission) just keep its distance.

    If the player now collides, with the intention to pull, it is the player that moves first, and the block is just following.

    Thanks! I get it!

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