How do I swipe images?

  • Hello C2 friends,

    i trying to undestand how i can "swipe" two pinned images (sprite) under a Layout (HUD)

    what i need to understand is :

    1. when i "swipe" left, on image#1, the image #2 come from right to left, and stopped under the hole

    2. when i "swipe" rigth, on image #2, the image #1 come form left to right, and stopped under the hole

    i see many tutorial, but are very complicated and is not relative to my question

    thanks in advace for any suggestion

  • I did something similar using these Sprite behaviors and plugins

    Drag and Drop . make it move horizontal only.

    Pin

    The Plug In : MoveTo

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I did something similar using these Sprite behaviors and plugins

    Drag and Drop

    Pin

    The Plug In : MoveTo

    yeah! thanks for idea : with 2 images it work

    but with 3 or 4 images?

  • [quote:foknkbp7]yeah! thanks for idea : with 2 images it work

    but with 3 or 4 images?

    I am sure there is an other (mabe easier) way to do this but one way is:

    I think I put put all the images in one 'topic' sprite, (each image has a frame number) then I cloned it ( not copied) and put three 'topic' sprites in a row pinned together,

    The center sprite is the MainTopic sprite.

    the left one is the LeftTopic, the right one the RightTopic.

    I then put 'trigger' sprites on each side ( left and right) of the MainTopic sprite ( far enough away for a natural slide effect)

    when the MainTopic > on collision with ( for example) LeftTrigger sprite> change frame number of

    all the topic sprites to appropriate frame> Set Position of MainTopic ( to opposite side of layout)

    For example:

    In an A,B,C slide game,

    The starting frame of MainTopic is A, Then, MainTopic (A) > on collision with LeftTrigger sprite> change LeftTopic frame to A, change MainTopic to B and change RightTopic to C > Set Position of MainTopic to

    (where B just was before the collision)

    also

    in my case when it hit Z, I just had it go back to A, so it looped over and over.

    when MainTopic collides with the trigger sprite you should 'drop' it so the MainTopic sprite return to the center.

    I placed an invisible sprite named MoveToSprite in the middle of the TopicMain , and had the MainTopic sprite > move to object > MoveToSprite > when drag dropped.

    Hope that helps

  • Hmm I made a template for browsing and selecting levels with swipe, I think it may work for your needs as well. You can try the demo and watch the videos here: https://www.scirra.com/store/royalty-fr ... ector-1006

  • I am sure there is an other (mabe easier) way to do this but one way is: (cut)

    wee, thanks for the suggestion, its work

    https : // www(dot)dropbox(dot)com/s/29ld045pr83rbja/simple%20swipe.capx?dl=0

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