Touch Coordinates are of When Layer is Scaled

Get help using Construct 2

Post » Fri Jul 27, 2012 4:35 pm

I have a problem...

When I scale a layer the touch coordinates are off. If I set a sprites position to Touch.X & Touch.Y when the layer is zoomed, the sprite is not where I'm touching.

Is there something have to do?
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049

Post » Fri Jul 27, 2012 4:46 pm

[quote=Native Expressions in Construct 2]Both the Mouse and Touch objects allow you to pass a layer parameter for the X and Y expressions. This is very useful if you scale or rotate layers.

e.g. Mouse.X("Layer 1") returns the mouse's X position on Layer 1, taking in to account its parallax, scale and angle. If you use only Mouse.X, it does not take in to account parallax, scale or angle, so the result can be wrong.[/quote]

In your case it would be Touch.X("Layer X") obviously, or Touch.X(0) for layer with index 0, but this should be what you're looking for.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452


Return to How do I....?

Who is online

Users browsing this forum: djcrazypants, marekmk and 6 guests

cron