0 favourites
  • 3 posts
  • Hi

    I used the Touch.AngleForID() expression and it doesn't generated useful values all the time, as described in the manual: <font color=blue>"A touch must be moving across the device screen for this expression to contain a useful value."</font>

    So I decided to build my own Touch.Angle expression and was amazed (thanks to the math.angle() expression) how easy it was.

    You just have to get the starting & ending Touchs X and Y and put it in math.angle() like this:

    angle(TouchStartX, TouchStartY, TouchEndX, TouchEndY) and you'll always get a correct and useful angle for your touch.

    And finally here's a little example (you can even use mouse to test):

    Hope this helps somebody.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just a heads up that what you've made is functionally different from the Touch angle expression. The touch angle updates in real-time based on the current direction of the touch - so if you swipe in an L shape, you'll get the correct touch angle towards the end of the swipe, whereas this method just tell you the angle from the start to the end.

  • Oh ok, I didn't know that but I thought that there's something more behind your Touch.Angle... <img src="smileys/smiley1.gif" border="0" align="middle" />

    But it might be useful to sometimes just have the whole touch angle as one "correct" value and so this will probably help some people.

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