drag an actor anywhere

GamepencilerGamepenciler Artist/Game DeveloperMember, PRO Posts: 326
I'm trying to make an actor follow and drag anywhere at the screen but I don't seem to be successful with it. It jumps choppily and I only can click along the actor size. I have the file here, can somebody tell me what's wrong with it?

Best Answers

  • KevinCrossKevinCross London, UKPosts: 1,894
    edited October 2013 Accepted Answer
    Use constrain instead of change attributes.
  • KevinCrossKevinCross London, UKPosts: 1,894
    Accepted Answer
    Try interpolate:

    Rule (Any): If touch is inside or touch is outside
    Interpolate: self.Position.X To game.Mouse.Position.X (change duration for speed)
    Interpolate: self.Position.Y To game.Mouse.Position.Y (change duration for speed)
  • KevinCrossKevinCross London, UKPosts: 1,894
    edited October 2013 Accepted Answer
    You'll find that with Interpolate it's the duration it takes to get from point A to B, and not the speed, so small movements will take the same amount of time as long movements, but it will travel faster for longer movements as it's got more ground to cover in the selected duration. You could get fancy and calculate the distance and adjust the duration accordingly but you may find it fine as is.

    If you can get "Move To" working that might be a better option as that uses speed.
  • jamie_cjamie_c ImagineLabs.rocks Posts: 5,772
    Accepted Answer
    @ecanhoj, I've re-attached your file so it works now. I just added the Constraints like Kevin mentions. It does not crash on my machine.
  • KevinCrossKevinCross London, UKPosts: 1,894
    Accepted Answer
    You have to keep in mind that with "Move To", or "Interpolate" you can no longer drag the actor. Constrain is the best way to drag the actor. It drags reasonably smooth without any major jumps.

Answers

  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    That worked.. but the actor is kind of teleporting.. how can it just follow direction to touch point?
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    thanks a lot @KevinCross I will try that :) awesome!
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    oh it didn't work the game crashed :(
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    Actually the attribute move to is exactly what I needed.. I didn't realize to use other attributes aside from change attribute... thanks again @kevinCross
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    I think i'm fine with the move to, I wanted a delay of positioning from A going to B.

    thanks @jaime_c @KevinCross great help
Sign In or Register to comment.