How do I detect a touch release that's outside of my actor?

tintrantintran Member Posts: 453
edited July 2015 in Working with GS (PC)

Like in my controls I have
If
-Touch Pressed
do
-Set a boolean to true
Else
-If
--Touch Released
-do
--Set a boolean to false
This is all fine except for when the I touch my actor and then drag my finger/mouse outside of the actor and release it there...then I don't know how to detect that in order to make it act like as if it was released while still on my actor.
My current solution right now is to make the actor (a control joystick) large enough and hope the user doesn't drag outside of that large area

Best Answers

  • ArmellineArmelline Posts: 5,407
    Accepted Answer

    Yes. Except false for the second part, but I'm assuming that's what you meant :D The reason yours isn't working is because you added the touch is released part. So yours is doing exactly what you asked it to, that just doesn't happen to be what you want.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,922
    Accepted Answer

    Ooh,ooh,ooh MR. Karter I know the answer.

    You use the touch count. when touch.count = zero set to false

Answers

  • ArmellineArmelline Member, PRO Posts: 5,407

    Why do you need the touch is released at all?

  • tintrantintran Member Posts: 453

    @Armelline said:
    Why do you need the touch is released at all?

    So that i can set my boolean to false indicating that finger is no longer touching the screen to stop whatever action i was doing when it's true.

  • ArmellineArmelline Member, PRO Posts: 5,407

    @tintran said:
    So that i can set my boolean to false indicating that finger is no longer touching the screen to stop whatever action i was doing when it's true.

    So you want to register the touch when it is anywhere on the screen, and want to register it when it is no longer touched anywhere on the screen?

    If you're only needing to detect the touch inside of the actor, and the release of that touch, then just putting the false change attribute in the otherwise should work fine.

  • tintrantintran Member Posts: 453
    edited July 2015

    @Armelline said:

    I want it the boolean to be true if touch is inside my actor, and stay true while touched and switches to false if the touch is released anywhere on the screen.

  • ArmellineArmelline Member, PRO Posts: 5,407

    This is what should happen with just a touch is pressed rule.

  • tintrantintran Member Posts: 453

    @Armelline said:
    This is what should happen with just a touch is pressed rule.

    How did you do it?
    Just if
    touch is pressed
    then set boolean to true
    else
    set boolean to true
    ?

Sign In or Register to comment.