How do I improve drag drop lag?

Get help using Construct 2

Post » Tue Feb 09, 2016 5:05 pm


I need a sprite object to move as close to the real touch drag as possible.
At the moment there seems to be s slight catch up from me dragging my finger over the screen and the object following.

When testing in a browser it appears alot faster by the mouse drag, so does this mean its a touch setting i can adjust, or a sad truth that using this tech I will not be able to get the game upto scratch to give the experience i need?
I am building using intelXDk, use cordova plugins, not game project.
Also to add, I am moving the sprite to the players finger using..

Touch-> Is touching (player obj) -> Player obj - Set X to Touch.X
Set Y to Touch.Y

Are there any other ideas or tips for getting the response to touch a little faster?

thanks for any help
Posts: 34
Reputation: 375

Post » Tue Feb 09, 2016 6:47 pm

This is because you can move your finger faster than the game has time to realize. The proper way to do drag-and-drop is to set a boolean for the object once you touch it, and set it off once you take the finger off the screen.


Create a boolean variable for the object called "Dragging"

Touch object (once) -> set Dragging true

X Touching (screen) -> set Dragging false

Object is Dragging -> Object Set X,Y to Touch.X,Y
Posts: 1,039
Reputation: 15,219

Post » Tue Feb 09, 2016 8:08 pm


Thanks, however i am not sure i follow or we misunderstand each other.

I need the object to move with the finger, the user needs to see this occuring as real time and upto date as the game can.

I have made a very simple demo ofjust a sprite and moving it with the finger, but always when the finger moves faster it begins to drag behind slighty. I wonder if this is actually C2, cordova, intel xdk or simply a common hardware / ios issue effecting native and hybrid apps?
Posts: 34
Reputation: 375

Post » Tue Feb 09, 2016 8:10 pm

I have tried adding fastclick.js to the html file after export before building. no difference.
Posts: 34
Reputation: 375

Post » Tue Feb 09, 2016 8:28 pm

That may be due to "double buffering", at least it sounds like it. Basically everything is drawn off screen first, then flipped to the screen. The result is a one frame delay behind mouse or touch input. It's less visible at higher framerates, since the distances between frames is less.

Now as far as I know C2 has no control over this, the browsers internally handle this detail. It's the same with android export I imagine but there might be a setting. I've never used mobile export so I don't know.
Posts: 5,157
Reputation: 63,450

Return to How do I....?

Who is online

Users browsing this forum: ashishv and 1 guest