Need Help Understanding Touch ID, etc...

0 favourites
  • 5 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Below is my current setup for a mobile touch screen analog (angle only) control stick.

    The idea is that the Button_Alog_Stick (hereafter just "Stick") will track the player's touch movement up to a maximum of 50 pixels from its base starting position. However, it will still move around in terms of its angled position as the player's touch moves around and even if the touch extends past the Stick's 50-pixel range.

    So long as the player initiates the touch on the Stick image and maintains that touch, even if the touch is no longer actually touching the Stick image, it recognizes the touch is in effect and the Stick will track the angle accordingly.

    The problem is that I cannot get this to work. I've reviewed the Touch object specs and apparently Has Nth Touch and On Nth Touch End are for when two or more touches are active. I simply want to isolate when the Control Stick is touched, maintain that touch regardless if the Stick is still being touched or not, and then take certain action when that Nth touch ends. Instead, the Stick acts like it's not being touched at all.

    Any suggestions/resolutions I could try?

  • Remove that condition and action where you said if width > 50

    Instead, replace the distance(Self.X, Self.Y, TouchCoordX, TouchCoordY) with:

    Set width to: min(50, distance(Self.X, Self.Y, Touch.CoordX, Touch.CoordY))

    That above will take the minimum value of the two, if the distance is larger, it will choose 50.

    ---

    In the 2nd event (with Has TouchID), also add: Is in Touch

    ---

    If doesn't work, share your c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If doesn't work, share your c3p

    Yup...didn't work.

    Just to recap what I'm trying to do.

    1. Player touches Button_Alog_Stick (or "Stick").

    2. Stick is positioned to the player touch coordinates up to a maximum distance of 50 pixels from the Button_Alog_Base object.

    3. If the player's touch coordinates extend well past the Stick so that the touch isn't even within image boundaries of the Stick object, the Stick will still position accordingly from the Base to the touch and the respective angle. (So, basically, it's just a lerp detail which you helped with using min().)

    4. Once the touch is released, with or without the touch actually in contact with the Stick, the Stick will revert back to its neutral position (this feature is not yet added).

    Here's the link to my c3p file via my Google Drive: https://drive.google.com/file/d/1z7H66c9zPFrt6Mu31VreHfJ3mwVW7PiT/view?usp=sharing

  • Sure, I'll have a look.

    Can't download that. Please make the sharing link an unrestricted (who has the link can open it).

    Thanks

  • Sure, I'll have a look.

    My apologies for the delay. I didn't get an email (or I missed it) saying that you had replied again.

    I went ahead and opted for a non-analog type of button scheme for this particular mini-game of mine. I decided it would simply work better overall that way.

    But I very much appreciate your willingness to help - that always means a lot to me. Thank you!

    I have about 3 or 4 different game modes for my game planned, so I might opt for analog-style controls for one of them. If I have further troubles, I will definitely contact you.

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