Two sprites swap locations

0 favourites
  • 4 posts
From the Asset Store
Full game Construct 2 capx code source to post on Google Play
  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try EaseTween behavior where you can specify xy distance, speed and tween:



  • 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!

  • 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

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