How do I push/pull objects smoothly?

Just started using Construct 2? Post your questions here

Post » Tue Sep 20, 2016 1:26 am

You're welcome, Justin64. :mrgreen:

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
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Tue Sep 20, 2016 8:16 pm

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"?
B
12
S
2
Posts: 33
Reputation: 714

Post » Tue Sep 20, 2016 9:41 pm

You're welcome, Justin64. :D
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Tue Sep 20, 2016 11:01 pm

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Sep 24, 2016 10:24 pm

99Instances2Go wrote: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! :D Now I just need help implementing it into Construct 2. :oops:
B
12
S
2
Posts: 33
Reputation: 714

Previous

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest