0 Favourites

How do I Adjust Touch coordinates while scaling layer?

  • 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?

    How can I make it shorter? round() will round this number to 1 (because scaling takes value between 0, 1 and 2).

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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:

    Touch.X(0)
    Touch.Y(0)[/code:msahtfiz]
    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).
  • 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:

    Touch.X(0)
    Touch.Y(0)[/code:2crfrhp9]
    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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,137
karshinkoff's avatar
karshinkoff
Unread hot topic
56 4,733
MPPlantOfficial's avatar
MPPlantOfficial
Unread hot topic
0 Favourites
Why is Stencyl doing better?
44 16,854
Potato's avatar
Potato