Multi Touch (Solved)

MikePL80

  • Posts: 45
Hi

I have a problem that I need some advice with before I resort to banging my head against my desk please   ???

I am making a 2D platform game with actors anchored to the screen to use for my on-screen controls.
I followed a really good tutorial on Youtube made by TheIndieStation and everything works perfect for the purpose that the tutorial was designed to achieve but I need advice on how to tweak it a little because I have tried a few things myself but nothing is working for me.

The situation is I have multi touch actors anchored on-screen for left/right/jump and fire. I want to be able to slide my thumb from a button without it leaving contact with the screen and for the behavior to set the boolean to false so I can stop my player actor from running and then be able to slide onto the left button without my thumb leaving the screen again and it in turn picking up the multi touch and settings its boolean to true to make my player run left.

Currently when I slide my finger from the left or right button my player continues running until your thumb has been removed from the screen and the player will continue to run no matter where your thumb is as long as its still in contact with the screen  :-\

I have attached the behavior for my multi touch.

Thank you in advance for advice you can throw my way

Mike

« Last Edit: September 03, 2015, 02:45:00 am by MikePL80 »

designpeg

  • *
  • Posts: 730
hi, you may have issues due to this bug I've discovered - http://community.stencyl.com/index.php/topic,43735.0.html. Basically all touch blocks are firing to many times. Hopefully it will get fixed soon.

MikePL80

  • Posts: 45
Hi

Thanks for your response but it sounds like a different issues to me.

I actually have no code in place telling the action to stop until a touch has been released so its a lack of instruction rather than a bug.

I'm just not sure what I need to do to instruct it to stop the event once the touch has left the touch coordinates rather than waiting for the touch to be released.

Thanks

designpeg

  • *
  • Posts: 730
ahh, I see what you mean. I've done something similar before by creating an invisible finger sized actor that follows the touch when a touch starts, then killing it when the touch ends, then using collisions between the invisible actor and the buttons. would that work for your situation?

TheIndieStation

  • *
  • Posts: 2263
Use a dragged event =)

First check which touch you are dragging, and if the X/ Y position gets lower then the X/Y OR bigger then X/Y + Width/Height of that actor, do the same as you would normally do with a release event.

MikePL80

  • Posts: 45
Hi TheIndieStation

I have already tried using a drag event and attempted to tell it that if the drag leaves the coordinates of the actor then to  set the target attribute to false but I guess I must be doing it wrong?

I assume I need to be telling if that if the touch ID is not equal the actors coorinates then to run the event?

Attached is what I attempted but it doesn't work   ??? Could you take a look at it for me please?

MikePL80

  • Posts: 45
I think I'm just trying to over simplify it  :-\

I'm going to change to a list attribute and collect the X/Y for the input ID so that I have more control over the dragging event.

Thank you both for your help

RyanZGrieco

  • Posts: 14
ahh, I see what you mean. I've done something similar before by creating an invisible finger sized actor that follows the touch when a touch starts, then killing it when the touch ends, then using collisions between the invisible actor and the buttons. would that work for your situation?

Hello, I am attempting to create something along this this line. I would like to be able to "bump" the actor on my screen with my finger by dragging it on the screen. Would this behavior that you created work for my idea? do you have an example of the code that you used?