# How do I limit drag speed and direction?

0 favourites
• 11 posts
From the Asset Store
16 Direction Capx
\$3 USD
40% off
Rotate & Animation for 16 Direction & Mouse Direction
• Sorry if this is basic stuff, I'm not that great at Construct.

How would one go about limiting how fast you can drag an object? As is the object being dragged will go as fast as you can go but what if you wanted it to drag slowly?

I also want to limit to dragging to both vertical and horizontal. I see you can select either one or the other but what is an easy way to do both?

thanks!

• add (60*dt) or lerp(a,b,measure) to the drag force? it all depends how your dragging happens... is it physics based? or top linear?

usually i use distance(x1,y1,x2,y2)+(60*dt) that gives a delayed dragged and a quick one when is in short distance. but not sure if is the desired movement you want.

• It's top linear, no physics. I just need it to go a short distance, it works fine when dragging at a normal pace but if the player drags as fast as possible it often breaks the game. I'll try out your suggestions, is it right to assume this is done with Custom Movement?

• It's top linear, no physics. I just need it to go a short distance, it works fine when dragging at a normal pace but if the player drags as fast as possible it often breaks the game. I'll try out your suggestions, is it right to assume this is done with Custom Movement?

not necessarily, but usually that is how i use it. if you have a default movement, just use the same (distance(x1,y1,x2,y2)+(60*dt))/10 as speed. and should work. the number "10" that i used to divide the distance, can be anything you want depending on your wanted results. lower then 10 is faster higher then 10 movement will lag a bit...

here is an example of the dt distance movement. 1st group is for a following pet/ etc 2nd is direct movement while your mouse/touch is down. this way it never breaks atleast i didn't managed to break it even if i were going bananas on mouse speed. hope this is what you needed.

i used the same movement in this demo here

however it has a mistake or lack of events in code, you need to add a "is not tapping" or " is not clicking" condition type so it happens only when dragging happens. other way youl find yourself with a small bug that on tap /click movement will start happening because of the distance being bigger then 0 .... now number 0 can be anything you want, that is your center point limit.

• ## Try Construct 3

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

Construct 3 users don't see these ads
• usa 2 objetos, uno con DRAG y otro con MOVETO...

el objeto drag sera arrastrado donde el dedo diga y el objeto moveto lo seguira...segun velocidad que le pongas

el objeto drag debe cubrir al objeto MOVETO...que de la impresion que es este el que arrastras.

• EXAMPLE

• PARA EL ANGULO:

USA "IS BETWEEN ANGLES" PARA ACTIVAR O DESACTIVAR

O

USA "COMPARE MOVING ANGLE" de MOVETO...AUNQUE ACA DEBERAS USAR 2 COMANDO PARA CENTRAR EL ANGULO REQUERIDO.

USA TAMBIEN "MOVETO XY"...EJE X: MOVETO XY:X=SELF.X Y:SPRITE2.X

FOR THE ANGLE:

USA "IS BETWEEN ANGLES" FOR ACTIVATE OR DISABLE

OR

USA "COMPARE MOVING ANGLE" by MOVETO ... ALTHOUGH YOU MUST USE 2 COMMANDS TO CENTER THE REQUIRED ANGLE.

USA ALSO "MOVETO XY" ... AX X: MOVETO XY: X = SELF.X Y: SPRITE2.X

• PARA EL ANGULO:

USA "IS BETWEEN ANGLES" PARA ACTIVAR O DESACTIVAR

O

USA "COMPARE MOVING ANGLE" de MOVETO...AUNQUE ACA DEBERAS USAR 2 COMANDO PARA CENTRO EL ANGULO REQUERIDO.

This is an English forum, moderated and searched in English.

Please ensure all posts are in English or provide an English translation, as stipulated in the Forum Rules.

Thank you.

• OK SORRY NO PROBLEM

• gamecorpstudio and NECRONOMICRON

thank you so much, these examples help A LOT. I should be able to fix my game with this new info.

• more easy:

USE MOVETO MAX SPEED to SET SPEED OF OBJECT

• 11 posts