How do I improve drag drop lag?

0 favourites
  • 5 posts
From the Asset Store
Now you can drop everything in your game with sound :)
  • Hi

    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

    Pete

  • 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.

    Example:

    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

  • HI

    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?

  • I have tried adding fastclick.js to the html file after export before building. no difference.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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