How do I Push object in 4 direction

Get help using Construct 2

Post » 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

Image

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

Post » 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
40
S
10
G
9
Posts: 213
Reputation: 7,057

Post » 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

Post » 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:
https://www.youtube.com/watch?v=Er3QdPh4H-U


I think you should use the solid behavior for all of your sprites.
B
40
S
10
G
9
Posts: 213
Reputation: 7,057

Post » 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

Post » Wed Nov 30, 2016 5:11 pm

Image

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
28
Posts: 2,493
Reputation: 20,950

Post » 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
75
S
31
G
27
Posts: 1,000
Reputation: 20,735


Return to How do I....?

Who is online

Users browsing this forum: zenox98 and 13 guests