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

Just started using Construct 2? Post your questions here

Post » Mon Mar 10, 2014 8:45 pm

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.
B
22
S
5
Posts: 107
Reputation: 2,354

Post » Tue Mar 11, 2014 10:24 am

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 :P
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

Post » Tue Mar 11, 2014 11:23 am

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,332
Reputation: 71,306


Return to Beginner's Questions

Who is online

Users browsing this forum: EuropaMin3r and 2 guests