GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Touch to move to position at specific speed

saad1993saad1993 Posts: 47Member, BASIC

Hello,

I've used the Move To behavior to move my actor to a touch input on screen. I can adjust speed in expression editor, not a problem. The touch input is then dragged and the actor is SUPPOSED to move with the drag at the speed specified. That does not happen. I've tried the Constrain Attribute Behavior but with that, the actor jumps to individual touch positions and that is just bad.

I want the actor to drag along with the touch at the specific speed. Can't seem to find a sure shot way of doing this.

Thanks!

Comments

  • SocksSocks London, UK.Posts: 12,822Member
    edited September 2016

    @saad1993 said:
    Hello,

    I've used the Move To behavior to move my actor to a touch input on screen. I can adjust speed in expression editor, not a problem. The touch input is then dragged and the actor is SUPPOSED to move with the drag at the speed specified.

    This seems a little confusing - or maybe I don't quite understand the question - if the actor moves with the drag and at the speed specified, then the player must drag the actor at a fixed speed ?

    Have I got that all wrong ? I mean, what happens if the player drags the touch point really quickly across the screen, does the actor move with the drag (i.e. stick to the touch point) or does it move at the specified speed (which could be faster or slower than the drag) ?

  • SocksSocks London, UK.Posts: 12,822Member
    edited September 2016

    This works, but I'm not sure about the drag speed issue . . .

  • saad1993saad1993 Posts: 47Member, BASIC

    @Socks said:
    Have I got that all wrong ? I mean, what happens if the player drags the touch point really quickly across the screen, does the actor move with the drag (i.e. stick to the touch point) or does it move at the specified speed (which could be faster or slower than the drag) ?

    To clarify, when the very first touch of the game is made, the actor will move at a custom speed towards the point (and not jump to it). The touch that was made will be kept in place .i.e the finger will not be lifted up. The user will drag the same touch input around the screen to move the actor. The actor will follow at custom speed.

    At least that is what I want it to do.
    What you showed in the image causes the actor to jump at the initial touch, and then if the user mistakenly lifts his/her finger up and touches again, the actor will jump to the location. I don't want the jumps, want a smooth speed.

    Hope that helps in clarifying.

  • SocksSocks London, UK.Posts: 12,822Member

    @saad1993 said:
    What you showed in the image causes the actor to jump at the initial touch . . .

    Can you share a screenshot of your version of this rule ?

  • saad1993saad1993 Posts: 47Member, BASIC

    @Socks said:
    Can you share a screenshot of your version of this rule ?

  • SocksSocks London, UK.Posts: 12,822Member
    edited September 2016

    @saad1993 said:
    What you showed in the image causes the actor to jump at the initial touch, and then if the user mistakenly lifts his/her finger up and touches again, the actor will jump to the location. I don't want the jumps, want a smooth speed.

    Your rule is completely different to the one I suggested ?

  • saad1993saad1993 Posts: 47Member, BASIC

    @Socks said:
    Your rule is completely different to the one I suggested.

    I used the one you suggested as well. The actor moves to the touch location. But then I have to touch the screen on another location to move the actor again. The drag function doesn't work with this behavior.

  • SocksSocks London, UK.Posts: 12,822Member

    @saad1993 said:

    @Socks said:
    Your rule is completely different to the one I suggested.

    I used the one you suggested as well.

    Can you share a screenshot of your implementation of the rule I suggested ? The rule works fine, you must have made a mistake somewhere ?

  • saad1993saad1993 Posts: 47Member, BASIC

    @Socks said:
    Can you share a screenshot of your implementation of the rule I suggested ? The rule works fine, you must have made a mistake somewhere ?

    You were right, I did make a mistake. Copied it as is in your image. Works like a charm! Thanks a lot! =)

  • saad1993saad1993 Posts: 47Member, BASIC

    It's behaving a little oddly. If I click and hold in the middle of the screen and move it even slight up or down. the actor moves all the way down or up of the screen. Could this be because I have constrained my actor's X at 40?

  • saad1993saad1993 Posts: 47Member, BASIC
  • SocksSocks London, UK.Posts: 12,822Member
    edited September 2016

    @saad1993 said:
    It's behaving a little oddly. If I click and hold in the middle of the screen and move it even slight up or down. the actor moves all the way down or up of the screen. Could this be because I have constrained my actor's X at 40?

    Can you share a screenshot of the rules you are using that are causing this issue ?

  • RThurmanRThurman Posts: 2,823Member, Sous Chef, PRO

    @saad1993 said:
    Could this be because I have constrained my actor's X at 40?

    Yes -- in that case, get rid of the constrain behavior and put "40" into the x field in the moveto behavior.

Sign In or Register to comment.