Author Topic: relative touch position from the center of a sprite  (Read 2079 times)

tasoson

  • Guest
relative touch position from the center of a sprite
« on: October 18, 2013, 12:11:56 AM »
Hi,

I am making a d-pad for an action game.
I want to get the relative touch position from the center of d-pad sprite to determine a direction, but I have no idea.

Could you help me? Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: relative touch position from the center of a sprite
« Reply #1 on: October 18, 2013, 06:00:46 PM »
Math. :P

Knowing widget's position A and touch screen position B, convert widget's position to screen coordinates, and subtract one from the other.