How do I make this custom swipe

Get help using Construct 2

Post » Sat Jan 14, 2017 4:12 pm

Image
Hi guys, i'm new to construct 2, how i can create a directional swiper when you need to click from point 1 and drag to poin 2 and not cross the sprite border ? The other question is how to apply sprite efect to just part of the sprite (where the current mouse position is). Thank you for any help.
B
8
S
3
Posts: 6
Reputation: 612

Post » Sat Jan 14, 2017 8:10 pm

On any touch start, set variable startx to touch.x, set variable starty to touch.y

On anytouch end
->compare variable startx is less than touch.x
-->compare variable starty is less than touch.y, do foo

Im not sure what you mean by sprite border.
For a trail just add an event to spawn a sprite at mouse x,y when in touch, then add the fade behavior.
Image ImageImage
B
169
S
50
G
173
Posts: 8,316
Reputation: 110,276

Post » Sun Jan 15, 2017 1:48 pm

I need to swipe the button from point 1 to point 2 exactly on specific trajectory, like on the pic.
B
8
S
3
Posts: 6
Reputation: 612

Post » Sun Jan 15, 2017 3:23 pm

There's a big difference between a swipe, and a curve gesture.
A swipe has a start, and an end point, and can have direction as well as speed.
Its fairly easy to do.

A curve gesture on the other hand also has a start and an end, but will sample multiple points in the movement to determine if it meets the loose definition of the specific gesture.. There's a few diferent ways to implement it, all of which are somewhat complicated.

Theres also a plugin which is overkill for such a simple gesture, but it would be the simplest method.
viewtopic.php?t=66773&start=0
Welcome to the rabbit hole.
Image ImageImage
B
169
S
50
G
173
Posts: 8,316
Reputation: 110,276

Post » Mon Jan 16, 2017 11:44 pm

newt wrote: There's a few diferent ways to implement it, all of which are somewhat complicated.

Thank you, can you give me a hint of what could be the implementations ?
B
8
S
3
Posts: 6
Reputation: 612

Post » Tue Jan 17, 2017 12:01 am

A simple method would be to average the points between the first and last point, and determine if that point was close to the midpoint, but still on the side of the hypotenuse.
Image ImageImage
B
169
S
50
G
173
Posts: 8,316
Reputation: 110,276

Post » Tue Jan 17, 2017 1:00 am

wow... i wont lie, i didnt understand anything from your message.
I`ll add new image, maybe i wrongly described what i want to accomplish.. i want to drug the ball along the curved shape of the pipe.
Image
B
8
S
3
Posts: 6
Reputation: 612

Post » Tue Jan 17, 2017 3:11 am

If the path is predetermined, and just needs the drag start I'd suggest taking a look at behavior-rex-spline_t178563
My first post should suffice as a trigger for a spline movement.
Image ImageImage
B
169
S
50
G
173
Posts: 8,316
Reputation: 110,276

Post » Tue Jan 17, 2017 9:12 am

Newt first post is indeed the solution that you need to replicate along the way of your picture.

Image

You need to calculate in a row that your user moves from Start to 1, and then from 1 to End, and when they arrive to End, that they went through 1.
So you need some global variable or array and change the value when Start to 1 has been successfully completed.

It is a bit involved for a complete newcomer.

Take your time, read several times all the informations provided here and be sure to read through the manual to learn more on Construct 2 and how it works.
If you need further explanation be as accurate as possible and you'll get accurate answers. If you don't understand this topic yet, you may not be ready to implement such a mechanic yet.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
291
S
114
G
95
Posts: 7,293
Reputation: 70,144

Post » Tue Jan 17, 2017 7:16 pm

Another idea is the curve looks to be an arc on a circle. Here's one idea to constrain the ball to that arc:
https://www.dropbox.com/s/weiffpc1dnhb8 ... .capx?dl=1
/examples34/track_drag_approx.capx

To make it perfect you'd need to tweak stuff. The radius, lowAng, highAng, the angle of the track and the origin of the track.
Last edited by R0J0hound on Tue Jun 20, 2017 5:42 pm, edited 1 time in total.
B
92
S
32
G
109
Posts: 5,290
Reputation: 70,991

Next

Return to How do I....?

Who is online

Users browsing this forum: RalleRoyal and 28 guests