Two sprites swap locations

Get help using Construct 2

Post » Wed Aug 22, 2012 2:57 am

Hello all. New to this forum and to this program.

I am toying around with Construct 2 and having a problem that I feel should have an easy solution:

Two Sprites. One in front of the other.
Sprite 1 starts at position 128, 512
Sprite 2 starts at position 320, 512

Upon pressing SPACE, I would like Sprite2 to move back to position 128, 512 (where Sprite1 starts) and stop. At the same time, I would like Sprite1 to move forward to position 320, 512 (where Sprite 2 starts) and stop.

I can accomplish the moving aspect by applying the Bullet behavior to both Sprites.

On Layout start:
Bullet behavior is disabled.

Upon pushing SPACE:
Bullet behavior is enabled
Both Sprite's become not solid (so that they can move past each other)
Sprite1's angle of motion is set to 0
Sprite2's angle of motion is set to 180

Try as I might, however, I cannot get the Sprites to stop at their desired locations. I have tried a few different options (specifically, Compare Distance Traveled to disable Bullet behavior), but can anyone tell me how to get Sprite1 to stop at 320, 512 and Sprite2 to stop at 128, 512?

As it stands, they just scroll to the end of the layout...

Thank you in advance for any and all help!
B
3
Posts: 2
Reputation: 279

Post » Wed Aug 22, 2012 10:14 am

Try EaseTween behavior where you can specify xy distance, speed and tween:

Demo

capx
B
79
S
32
G
23
Posts: 119
Reputation: 14,937

Post » Thu Aug 23, 2012 4:14 am

Thanks Kastas!

This is exactly what I needed. I do wonder if there is a way to do this without the EaseTween Behavior plugin. Nevertheless, this enables me to move past something that's been stumping me for a few days now!
B
3
Posts: 2
Reputation: 279

Post » Fri Oct 04, 2013 8:39 am

Hello all.
I want to swap more than 6 sprites randomly.
I dnt want them to swap like Match 3 game.
I dnt knw how to do it.
Plz help me out

B
1
Posts: 1
Reputation: 127


Return to How do I....?

Who is online

Users browsing this forum: Khamsou and 15 guests