playMaker

Author Topic: Touch Control (Touch & Drag)  (Read 991 times)

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Touch Control (Touch & Drag)
« on: November 27, 2018, 05:06:25 PM »
Hi !

Managed to insert joystick into game for mobile game. Character moving only when touched and dragged the joystick image.
Check this game. In this game, player will move when touch touch and drag on any part of screen. How to get it done?

« Last Edit: December 03, 2018, 01:10:09 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Touch Control (Touch & Drag)
« Reply #1 on: December 03, 2018, 01:14:41 AM »
Hi,

[ADMIN] note on post subject: only put [SOLVED], putting [NOT SOLVED] doesn't bring a positive vibe :) thanks. Pleas ping or pm me if you don't get an answer.


you need to register the drag start point, and then check the current drag position, deduce the distance between the current position and start to double it's not close to 0, and you also need to get the signed angle between the current and start position to know where to push the ball ( use the signed angle custom action on the ecosystem).

 you could also get the vector between the current and star position, normalize it, then multiply it by the desisred ball speed and set the velocity of the ball using that vector.

Bye,

 Jean