So I am experimenting little bit with touch controls.
background: game is gravity side scroller (you are running around circular planets) trying to get to other planets.
I was thinking how to make control such that player will move (or go by itself) until it gets to closest point you touched on screen.
My idea was to use half circle objects that will rotate on the screen with player. But that only kind of works only until player is in the centre of the screen.
Next I was thinking if it was possible to calculate function y = k*x + b(where player would be 0,0 of the grid and his up angle would the parameter k) so that you can test if b = y - a*x is zero(x,y are coordinates of the touch). It it is more then zero player would be pressing left until it is zero, and if it is less then zero, player would be pressing right until it is zero. But I could not get this working correctly (even for the half of the screen).
<img src="https://dl.dropboxusercontent.com/u/71343504/construct2/touchfunction.jpg" border="0" />
Do you have any suggestion, ideas?