Touch to move to position at specific speed
saad1993
Member, BASIC Posts: 47
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
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) ?
This works, but I'm not sure about the drag speed issue . . .
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.
Can you share a screenshot of your version of this rule ?
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.
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!
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 ?
Yes -- in that case, get rid of the constrain behavior and put "40" into the x field in the moveto behavior.