I'm trying to create simple 2d platformer touch screen controls without ui buttons. Basically what I'm trying to archieve is: touch and hold on either side of player to make her move towards that x direction, and to touch or swipe above the player to make her jump or climb.
Note that I'm a complete beginner with code.
I think I need to write something like:
var player position
var touch position (hold)
if touch position x > player position x
move +x (=left)
if touch position x < player position x
move -x (=right)
if touch position y < player position y
jump (or climb if ladder etc.)
I have no idea of the feasibility of this. Atleast jumping/climbing would probably would need some margins between player position and the touch position x/y, so that you need to touch/swipe pretty directy above the character, and similarly touch+hold x direction far enough from the character.
I'm grateful for any feedback, ideas and especially examples with code of how to write this.
(I'll add my best try to comments.)