Problem with mobile twin-stick, how can i solve?

0 favourites
  • 5 posts
From the Asset Store
This is a twin stick shooter similar to Enter the gungeon,Nuclear Throne, Helldivers & Soul knight for the mobile device
  • HI Guys, I'm new in construct 3, I'm starting to develop a twin-stick shooter to work on web, for desktop and even on mobile, I'm starting to program the mobile controls first, I'v made the sticks (left and right) recognize the touch id property and both works great, but I'have a big mistake with the left stick, the once used for move the player, I tell how it works:

    - I set a touch ID recognition for works with multi touch

    - If i touch on stick, it's recognize the touch ID and store the value in a variable (one dedicated to the left stick and one for the right stick), variable used for continued use of the associated stick

    - If i release the stick, it's reset to "idle" state

    - I can use simultaneously stick with no problem but...

    - If i use both stick but I release the left stick when i using the right stick at the same time, the left stick doesn't return to the "idle" state, but continue to works in a wrong way, It's like he pressed for go on top, the correct way is when i released the left stick he stop to works and return to the "idle" state

    - I programmed the right stick in the same way, but it's work well if I release the right stick when I use the left stick at the same time!

    - How can i fix this problem? I attach the screen of my event sheet

    Thank you! And sorry for my bad english!!!

  • Sorry, I didn't try to understand your code, there's a lot of it.

    I have a simpler demo of twin-stick, take a look:

    dropbox.com/s/rrpxnmer3gwhl88/DoubleVirtualGamepad_v3.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you, your example works great, but works even if you touch outside the analog, in my case I would try to make an analog stick that's start working only if the player touch inside the analogue.

    In your case for example if you touch the left analogue and then touch in the first half screen, the analogue will move in the direction of the last touch, and it's a problem, because if I insert a touchable object in the scene, the player will move in the direction of the click.

  • You can easily prevent this - instead of "Pick nearest" sprite to touch position, use "System pick by overlapping point" event. Pick the Big sprite that's overlapping point Touch.XAt(loopindex, "HUD"), Touch.YAt(loopindex, "HUD").

    You may want to make the collision area of the Big sprite slightly larger than the image.

  • I'v solved in my code, this is how i do this fix:

    First of all, construct doesn't "destroy" the touch, but set the position at point 0, 0, for every touch point (ids), so for fix this issue I'v added a conditions on my left stick to check if the leftStickTouchID.X isn't in position 0.

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