Construct 2 Multi-Touch Controls - New Question

0 favourites
From the Asset Store
Casino? money? who knows? but the target is the same!
  • AmpedRobot

    I hear your frustration... making a bulletproof multi-touch interface is definitely a very advanced function in C2 - and that is not C2's fault. It gives you the tools to do it. It is up to you to define what the touches mean to the game.

    Rather than use an array, I like to create a sprite object for each active touch. Then you use those to track where the touch is, what it is touching, what it can do, how to handle over-lapping controls, etc...

    I re-created your project using the bare minimum elements from yours, and my standard multi-touch method. I put in as many comments as I could, so I hope it makes sense. I had to add a couple instance variables to the beacon so only one touch could try to control it at a time...

    any touch that does not start on a control, or is not controlling the beacon is tracked, but ignored. So this version will work with any number of touches.

    you can download my version here: http://www.rieperts.com/games/forum/touch_test.capx

    Update 1: oh, yeah - normally I would have the TouchPoint sprite invisible, but I left it visible so you can see them for testing purposes...

    Update 2: Another thing - I put the controls in a Family, so you can do one test to see if a new touch is meant to update controls, or to try to move the beacon. Any other controls added should also be added to the family...

    alright, last update: I copied the code to move the ship and beacon from your file, but normally I would have the controls on a non-movable HUD layer (Parallax 0,0), and make the layer the ships are on scroll around (rather than moving all the objects individually). To do that I would create a camera object (with Scroll To) on the game layer and move that as necessary... You probably know that - I realize you were just testing touch.

    Thank you. Very impressive. I am glad it was my lack of understanding of the provided features (though not necessarily my own fault given the poor documentation/lack of examples), not a failing of Construct 2's functionality. And I knew my post was clear enough.

    This is exactly what I was looking for.

    I have a super multi-touch version here too:

    darksunpictures.com/public/touch_tests_orig.zip

    which glitches when you release fingers too fast, but works in sequence.

    Since yours doesn't glitch, I'm sure the answer is in there somewhere.

    Unfortunately, I'm operating on like 1 hour of sleep in 3 days right now, given my poor shared living situation, so I'll have to wait a few days until I can get some sleep before I can study your capx thoroughly.

    I am glad you are around on these forums.

    And had something like this been included for example as a link with the touch object documentation in the Construct 2 manual, it would have made Construct 2 look like a million bucks.

  • AllanR

    How would I integrate a deadzone into this? Meaning the Beacon only updates position, IF NOT ON THE PLAYERSHIP (if pressing on screen outside touch controls [leaving everything else alone]).

    Basically, trying to prevent God mode with this because touching ship near center works much faster with the turning (some players are crafty.)

    I realize this may involve a pretty extensive revamp of the logic given the else statements.

    So far my attempts at inserting an overlap condition on the Touchpoint via another Boolean instance variable such as PassingOverShip and testing the overlap have proven unsuccessful.

    --

    Nvm, figured it out!

    Had a weird old collision polygon.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How would I make this addition?

    Second touch dragged onto controls also affects controls.

    I tried to program this as:

    -it's not new touch

    -beacon is touched (as the first touch?)

    -is overlapping controls

    or

    else is not started on control

    is not new touch

    or

    -Has Touch 2

    -beacon is touched

    -is overlapping controls

    But none of it's working.

    --

    I'm new to this succinct form of programming with a lot going on implicitly.

    I think I understand the logic tree and what's going on, but modifying it has not proven easy.

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