# How do I Push object in 4 direction

Get help using Construct 2

### » Tue Nov 29, 2016 8:56 pm

Hello,

i want the player (blue block) to push object in 4 direction (up, down, left, right) to 32 pixels
i don't know if i have to set the behavior of the player and the object to 4 direction, or only one of them
i'm sure the player must be a 4 direction (behavior) but i'm not sure for the object, i'm really stuck

and for the mouvement i want the object to move like this

here is a capx example

Code: Select all
`https://www.dropbox.com/s/44vx73p31aeboz8/push_in_4_direction.capx?dl=0`

thank you very much
B
4
S
1
Posts: 40
Reputation: 532

### » Tue Nov 29, 2016 10:04 pm

I think you have to use lerp expression.

lerp(a, b, x) - Linear interpolation of a to b by x. Calculates a + x * (b - a). )
B
47
S
11
G
10
Posts: 237
Reputation: 7,902

### » Tue Nov 29, 2016 10:48 pm

thank you,

so in A i set the sprite in his curent position and for B the final position ? and for x ? speed ?

should i use it in set position to (action) ?
B
4
S
1
Posts: 40
Reputation: 532

### » Wed Nov 30, 2016 9:00 am

I tried with the "lerp" expression but I'm doing something wrong. Maybe someone else will help you with this. In the meantime you can check this tutorial and try to integrate it in your scene:

I think you should use the solid behavior for all of your sprites.
B
47
S
11
G
10
Posts: 237
Reputation: 7,902

### » Wed Nov 30, 2016 12:24 pm

Thank you @anty21ro this tutorials are so good, i think i'm okey with the player mouvement

but the push action, i can't solve it yet
B
4
S
1
Posts: 40
Reputation: 532

### » Wed Nov 30, 2016 5:11 pm

I dont understand this way of 'moving'.

Say, from that position, i press 1 down, 2 left, 1 up.
What will happen on the second press left ?
What will happen on the up ?
B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

### » Wed Nov 30, 2016 7:27 pm

Here's one way to do it without lerping.

https://dl.dropboxusercontent.com/u/700 ... ction.capx

Families could have come in handy, but since you don't seem to have a license, I went without.
B
81
S
33
G
27
Posts: 1,029
Reputation: 21,143