MoveTo behavior request?

0 favourites
From the Asset Store
2D Tile Set
$2.99 USD
Tile map for your 2d platformer games, custom sets available on request
  • lerp(self.x,target.x,yourspeed*dt)

    lerp(self.y,target.y,yourspeed*dt)

    Target, as well as yourspeed can be a variable.

    This is a misuse of the lerp function, and should not be used (the ease in actually when you are using this is caused by the fact the distance between the self and the target is reduced, but the target will not be reached except if there are errors accumulating)

    If you want to go from a to b, either move with clamp(self.x+speedx, self.x, target.x) (depending on where is the target, you might want to adapt the formula) or using lerp(initialx, target.x, percentage) with percentage increasing from 0 to 1

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • A0Nasser are you using this plugin with construct r175? I'm getting this error from construct:

    '

    " Unable to load plugin in ' C:"Program Files\Construct 2\exporters\html5\rex_moveto\' : Found "GetPluginSettings" global, but this is not a function. "

  • vitorfgd

    Yes i'm using it with r175 and it's work fine.

    How did you upload it to C2?

    You need to put the folder on the C2 behaviors path.

  • Damm, sorry, I'm used to the plugin cocoonjs and was putting this in plugins folder. Many thanks for the warning ; )

  • > lerp(self.x,target.x,yourspeed*dt)

    > lerp(self.y,target.y,yourspeed*dt)

    >

    > Target, as well as yourspeed can be a variable.

    >

    This is a misuse of the lerp function, and should not be used (the ease in actually when you are using this is caused by the fact the distance between the self and the target is reduced, but the target will not be reached except if there are errors accumulating)

    If you want to go from a to b, either move with clamp(self.x+speedx, self.x, target.x) (depending on where is the target, you might want to adapt the formula) or using lerp(initialx, target.x, percentage) with percentage increasing from 0 to 1

    Its perfectly reasonable for something like this.

    If you need it to be to the pixel add a wait x seconds, put a set xy to target xy, and change the Boolean that gave it movement to false.

    Then again "to the pixel" isn't a very good idea either.

  • megatronx

    Uh... no, it would not. It will move to the latest target set by action. And there has an action to stop the moving.

    Yeah, but stopping the moving is not canceling the target. Would it be possible to change the target on the go?

  • megatronx

    I made a sample capx, which assign a new target before hit current target, the current target will be overwrote to the new one.

  • megatronx

    I made a sample capx, which assign a new target before hit current target, the current target will be overwrote to the new one.

    Brilliant! Thanks! But unfortunately I'm still on 173r.

  • I use a lot moveto, a very useful and nice behavior!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)