How do I make dual stick touch controls ?

0 favourites
  • 11 posts
From the Asset Store
Surena Touch
$2.50 USD
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • Hey,

    I'm trying to make two sticks touch controlled in my game : one for moving the character (only for left and right) and one for shooting 360°. They should be floating. I followed this tutorial :

    https://www.scirra.com/tutorials/398/to ... ers/page-4

    But it's awfully complex and it's for moving a character, not shooting in a straight line. Could somebody give me a more simple way ?

  • I've used something like this:

    https://www.scirra.com/forum/360-aiming-with-a-gamepad-using-the-right-stick_t87397

    Pay attention to the 9th post.

  • I'm sorry but isn't this post is about physical controllers ?

    I was talking about a virtual controller

  • Need to bump the topic because I'm starting to pulling my hair out.

    I made changes because I couldn't succeed to have dual sticks, so now it's UI-less : the screen is divided in 2, swipe left or right at left side for running, tap, swipe or hold on right side for different actions. But Construct seems to weirdly handle multi-touch. If I start running and then jumping for exemple, it's working, but if I'm jumping, THEN running while keeping finger on right side, the direction is messed up.

    I tried making tons of events for handling each touch index, but they seem to override each other, so at the end there's still a move that will be wrong.

    Someone have an idea ?

  • Have you learned how to track touch ID?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, I know the thing with "one touch = one arbitrary ID". Is that sufficient ?

    Anyway here's a capx for example. I've tried other settings but this is the most recent one (not commented, sorry !).

    https://www.dropbox.com/s/fphdgr0if841dxm/Touch%20test.capx?dl=0

  • Haven't looked at your capx yet but what I mean is tracking the touches so they don't affect each other. So you would have on touch ends & Touch ID equals X

    I haven't done two joysticks but I have done control pad and buttons, you can see by clicking the ninja picture in the middle of my signature. It took some testing and debugging but it is definitely possible

  • I understand the concept, but what's the application ? Which event do I need to do, is it with variables ?

  • I can't find the tutorial I used but here is what I did:

    Global Variable ControlPadTouchID (forgot to capture in the snip)

    I crossed out some unrelated events and highlighted the ones pertaining to ControlPadTouchID

    Basically there are three steps:

    • Anytime a touch starts it checks if it is touching the control pad. If so it changes the variable to the touch's ID
    • If the variable is not -1 then that touch's location will be tracked to determine which direction to move
    • Anytime a touch ends there will be a check to see if it was the touch ID stored in the variable. If it isn't then the control pad movement isn't interrupted. If it is then the variable will be set to -1 which stops step 2

    Should be able to make another global variable for the other controlpad/joystick and duplicate the events. The touches should be tracked separately and not interfere with each other.

  • Well, first your events were not really transposable to my layout, but I could make something out of the logic behind it. So for the basic actions (move and jump) it works, I hope it will be the same with the more complex ones (swipe and everything). Thanks a lot ! Too bad that's there's so few tutorials about touch controls

  • I'm sure every time someone shares their events you will need to customize some for your layout. I hear ya on the tutorials. I found a good one on it but can't find it again—there needs to be upvotes or something on tutorials so the more useful ones are easier to find.

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