0 Favourites

How do I move to a position ?

  • Hai.

    I know there is a move to position action, but it just move there in one step.

    What if i need to move at a certain speed toward a direction ?

    i saw there is set angle and move forward actions, but this makes the sprite rotate. Wich i don't want..

    There's also using the lerp(self.X,target.X,percentage) that works, but it'll only ease out and i can't control the speed.

    Someone knows ?

    Thanks a lot :s

  • Two user created plugins come to mind - 'Move To' by RexxRainbow and 'Liteween'.

  • you need a plugin to set a vector movement ....? hu... ok. i'll check then.

    thank you

    PS: but there is no other way than using pugin ? (just asking)

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You could look at the move to example shipped with Construct2..

    It uses the bullet behaviour..

  • I was still editing my post - adding links - when you responded.

    I was also going to mention the bullet behavior, but LittleStain has already beat me to it.

  • Thanks ! i'll check that

    Or maybe make a function that i can use anywhere, with Custom movements or i dunno

  • Ok i see for the bullet example, but it rotates the sprite.

    You cannot set angle to position without rotating the sprite... so that doesn't do it for me.

  • Ok, i finally found how to install and use MoveTo " by Rex, seriously this thing is crazy useful.

    Why not in C2 ? like , it shouldn't be hard to implement it no ?

    even like this as it is, just add rex's folder (if he accept) into the install of the software ?

    Thank you so much anyway, i'll gain soooo much time now.

  • Ok i see for the bullet example, but it rotates the sprite.

    You cannot set angle to position without rotating the sprite... so that doesn't do it for me.

    You could just set "set angle" to "no" in the bullet properties..

    And instead of using set angle, set the angle of motion of the bullet..

  • >

    > You could just set "set angle" to "no" in the bullet properties..

    > And instead of using set angle, set the angle of motion of the bullet..

    >

    No. because set angle of motion ask a degree. Wich i don't have. I have a target (object .X and Y) and thats all.

    Its a big hole in C2 i think, to at least not have a kind of "lengthdir" function in it...

    People could easily code their own tween movements with events if there was just that.

    or a simple option "move toward position" with a pixel per tick.

    But , you can still use a var to store the angle toward position, then reset angle of the object to 0.

    And use this var to set angle of motion.... it works, but OMG its complicated for such a small thingy.

    Anyway LiteTween is better i find than moveTo. Hope it'll be stable :s seems pretty heavy behavior

  • >

    > >

    > > You could just set "set angle" to "no" in the bullet properties..

    > > And instead of using set angle, set the angle of motion of the bullet..

    > >

    >

    No. because set angle of motion ask a degree. Wich i don't have. I have a target (object .X and Y) and thats all.

    Its a big hole in C2 i think, to at least not have a kind of "lengthdir" function in it...

    People could easily code their own tween movements with events if there was just that.

    or a simple option "move toward position" with a pixel per tick.

    But , you can still use a var to store the angle toward position, then reset angle of the object to 0.

    And use this var to set angle of motion.... it works, but OMG its complicated for such a small thingy.

    Anyway LiteTween is better i find than moveTo. Hope it'll be stable :s seems pretty heavy behavior

    Set angle of movement : angle(player.x,player.y,target.x,target.y) should work..

    Also setting a state to moving and while moving move 1 px at angle..

    It's all there..

  • Set angle of movement : angle(player.x,player.y,target.x,target.y) should work..

    my bad !! ^^

    It's exactly what i was looking for ! (yes, i should read the manual.... duh)

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