How do I swipe images?

Get help using Construct 2

Post » Sun May 17, 2015 1:29 pm

Hello C2 friends,

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

Image

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
:)
B
8
S
1
Posts: 17
Reputation: 503

Post » Mon May 18, 2015 3:29 pm

I did something similar using these Sprite behaviors and plugins
Drag and Drop . make it move horizontal only.
Pin
The Plug In : MoveTo
Last edited by producermark11 on Tue May 19, 2015 12:39 am, edited 2 times in total.
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Mon May 18, 2015 5:34 pm

producermark11 wrote: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?
B
8
S
1
Posts: 17
Reputation: 503

Post » Tue May 19, 2015 12:20 am

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
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Tue May 19, 2015 9:21 am

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
B
39
S
9
G
4
Posts: 163
Reputation: 6,516

Post » Tue May 19, 2015 3:09 pm

producermark11 wrote: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 :D

Image

https : // www(dot)dropbox(dot)com/s/29ld045pr83rbja/simple%20swipe.capx?dl=0
B
8
S
1
Posts: 17
Reputation: 503


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 47 guests