0 Favourites

I need Touch positioning with zoom but it's broken!

  • Hello,

    I have two layers; "main" and "overlay."

    "main" is scaled 200, but "overlay" isn't.

    I created an event that sets a ball sprite's position to "touch.x" and "touch.y" on touch, but for some reason the ball's position is drawn to the center of the screen.

    Even if I try touch.absolutex and touch.absolutey, it still doesn't work right

    Why is this broken? I really need this function.

  • It's not broken. You can open a paranthesis after touch.x and include which layer you are representing the position in, like:

    touch.x("Gameplay") - using the layer name

    or

    touch.x(2) - using the layer order number.

    Fiddle with this idea, search the forums and you shall find what you seek young padawan

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • [quote:ui38y5vp]X

    Y

    XAt(index)

    YAt(index)

    XForID(id)

    YForID(id)

    Return the current position of a touch in layout co-ordinates. It changes to reflect scrolling and scaling. However, if an individual layer has been scrolled, scaled or rotated, these expressions do not take that in to account - for that case, use the layer versions below. The At expressions can return the position of any touch given its zero-based index, and the ForID expressions return the position of a touch with a specific ID.

    X("layer")

    Y("layer")

    XAt(index, "layer")

    YAt(index, "layer")

    XForID(id, "layer")

    YForID(id, "layer")

    Return the current position of a touch in layout co-ordinates, with scrolling, scaling and rotation taken in to account for the given layer. The layer can be identified either by a string of its name or its zero-based index (e.g. Touch.X(0)). The At expressions can return the position of any touch on a layer given its zero-based index, and the ForID expressions return the position of a touch with a specific ID.

    From the manual article about the Touch plugin.

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