Touch overwrites collide problem

diegocsdiegocs Member Posts: 531
edited November -1 in Working with GS (Mac)
i have an actor that i control with touch, and i have obstacles in my scene which the actor is suppose to collide with (not bounce), but the problem is that the touch overwrites the collide rule, and i don't know how to fix it, so that when the touch controlled actor collides with the obstacle it stops/ doesn't go through it

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I am assuming you have a rule that says when touch is pressed constrain x and y to touch1x and touch1y

    Try putting those constrains in two rules:

    Rule when touch is pressed
    ------Rule when touch is inside
    ----------Constrains

    This should help because when the actor collides and you keep dragging, your finger will go outside the actor and it will stop constraining.
  • Metronome49Metronome49 Member Posts: 297
    @scitunes et al... Can you elaborate on this? I have a draggable piece, that when it takes a bullet, is knocked back slightly, and I want it to still be knocked back even if your finger is on it. I tried a "draggable" attribute that turns off when it overlaps or collides with the bullet, but the touch still overrides that.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    touch is not overriding it. the constrains override collisions. so you'll have to get creative to get that to all work properly.

    Maybe setup a self.Draggable boolean attribute and have the touch rules setup when touch is pressed and self.draggable is true ………….

    And then have a second rule when overlap or collide with actor2 change self.draggable to false---Otherwise Change self.draggable to true.

    ___________________________________________________________________________________
    Project Help from Tenrdrmer Click Here

    GS BubbleBall Template HERE!!
    Stacks Level Selection Template HERE!!
    Expanding Option Menu Template HERE!!
    Tenrdrmer's Menu # 3 HERE!!
    Menu #4 - Level Banners HERE!!
    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Metronome49 said:
    @scitunes et al... Can you elaborate on this? I have a draggable piece, that when it takes a bullet, is knocked back slightly, and I want it to still be knocked back even if your finger is on it. I tried a "draggable" attribute that turns off when it overlaps or collides with the bullet, but the touch still overrides that.

    i just did a test and this works

    in your draggable piece have when touch is pressed constrin attribute self position x to mouse position x, and constrain self position y to mouse position y

    then have another rule in your draggable piece when actor overlaps or collides with bullet
    interpolate self position x to self position x-25
    and set the duration to .5

    the interpolate will over ride the constrain when the overlap happens so it will push back like you want then go back to where your finger is and still be draggable
  • Metronome49Metronome49 Member Posts: 297
    That's exactly what I did, and I thought it would work.

    Glad to see that I'm starting to think "creatively" in GameSalad.

    It seems like if your finger is on the actor, and you're dragging, if draggable is turned off while you're dragging, the touch action doesn't care, it's already working.

    Maybe it has to do with my only having pressed OR inside during testing, instead of both?

    Maybe I messed something up, I'll go back and check.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    make sure you have it set to require all. And only used pressed I wouldn't used inside the constrain should stop if it collides and shuts off draggable.
  • Metronome49Metronome49 Member Posts: 297
    @JohnPapiomitis

    Hmmm. That's pretty interesting, I haven't got in to interpolate yet.

    What if I don't want it to go back to where it was, and I just want it to move back, and then have to be clicked again to be dragged again? Like it was knocked out of your hand.

    Thanks.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    I just tried and that method does work to stop the drag but it doesn't let you pick it back up again. because it stops while stuck to the other actor.

    john method will prob work better. since he has a bounce built into the rules
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Metronome49 said:
    @JohnPapiomitis

    Hmmm. That's pretty interesting, I haven't got in to interpolate yet.

    What if I don't want it to go back to where it was, and I just want it to move back, and then have to be clicked again to be dragged again? Like it was knocked out of your hand.

    Thanks.

    You can prob work to incorporate both methods to fine tune it exactly to what you want.

    ___________________________________________________________________________________
    Project Help from Tenrdrmer Click Here

    GS BubbleBall Template HERE!!
    Stacks Level Selection Template HERE!!
    Expanding Option Menu Template HERE!!
    Tenrdrmer's Menu # 3 HERE!!
    Menu #4 - Level Banners HERE!!
    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    yep exactly like tendrmer said you would incorporate both methods into one

    just finished a demo for you

    http://www.mediafire.com/?49cj31qcjybf0z2
  • Metronome49Metronome49 Member Posts: 297
    Okay, cool. I'll look at that when I get home.

    I guess in the case where it stops on the other actor and can no longer be moved it wouldn't affect me anyway, as I not only have a timered change velocity backwards (which will now probably be some interpolate wizardry), but the "bullet" actor will go away for recycling.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    yeah the demo i made you should work fine for that. You should only need the extra rules for the bullet to move and revycle you wont have to change anything in the dragger actor
Sign In or Register to comment.