How do I Adjust Touch coordinates while scaling layer?

Get help using Construct 2

Post » Sat Feb 21, 2015 3:37 pm

Here is a gif, explaining what I mean.

How do I adjust touch coordinates, to create these 4 colored blocks on correct positions considering the layer scale?

Also, should I worry about long numbers like this one?
Image
How can I make it shorter? round() will round this number to 1 (because scaling takes value between 0, 1 and 2).
B
38
S
15
G
6
Posts: 238
Reputation: 7,770

Post » Sat Feb 21, 2015 4:41 pm

UPDATE: I just realized you said layer scaling, not layout scaling, which my original info referred to. Refer to the manual entry for touch. X and Y don't adjust for layer scaling/rotation/what have you unless you give it a layer as a parameter. For example:

Code: Select all
Touch.X(0)
Touch.Y(0)

Gives you adjusted touch coordinates for layer 0.

As for the number length, you absolutely should not worry about that. There's no extra work processing a high precision number like that vs. a rounded number, so long as internally they're stored as the same type(which they almost certainly are).
Moderator
B
104
S
39
G
19
Posts: 1,584
Reputation: 18,167

Post » Sat Feb 21, 2015 6:47 pm

linkman2004 wrote:UPDATE: I just realized you said layer scaling, not layout scaling, which my original info referred to. Refer to the manual entry for touch. X and Y don't adjust for layer scaling/rotation/what have you unless you give it a layer as a parameter. For example:

Code: Select all
Touch.X(0)
Touch.Y(0)

Gives you adjusted touch coordinates for layer 0.

As for the number length, you absolutely should not worry about that. There's no extra work processing a high precision number like that vs. a rounded number, so long as internally they're stored as the same type(which they almost certainly are).


Thanks alot!
B
38
S
15
G
6
Posts: 238
Reputation: 7,770


Return to How do I....?

Who is online

Users browsing this forum: makkancs, work3 and 0 guests