Touch with offset

0 favourites
  • 9 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • I am trying to move an object with the touch using an offset, it seems to work, but when I release the touch, it is teleported to the top left of the screen, I don't understand why, it is as if it ends up in the offset coordinates, what can i do to prevent it?

    Touch Touching sprite ->

    sprite offset X - Sprite X

    sprite offset Y - Sprite Y

    Sprite Set position ->

    touch X - Sprite offset X

    touch Y - Sprite offset Y

  • Touch.x or y will return 0 if its not actually in touch, so there's your clue.

  • They don't actually go to position 0 0 but move to the offset position that remains in memory, but the problem remains, can't it be corrected somehow?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Update the coordinates.

  • I tried like that

    Every Tick touch touching sprite

    set oldX to selfX

    set oldY to selfY

    set offsetX to oldX

    set offsetY to oldY

    but I did not get the desired result

  • I changed with

    wait for the previous actions

    now the object disappears for a thousandth of a second and reappears in the desired position, I see it for an instant appear at the top left: D

  • No idea.

    Perhaps you should take a look at the drag and drop behavior for ideas.

    Otherwise post a project.

    There is most likely no reason to use "Every Tick" for any reason.

  • Now it works perfectly, but I always use every tick to track the position of the object, are there any problems with using every tick? How else can you keep track of an object? Would it make a difference every second?

  • Use your logic, you only need to modify it when you're touching it.

    Every tick is like yelling at a rock.

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