Jump to content

How to get velocity from a tween


Recommended Posts


My challenge: I have a platformer in which I have platforms moving based on tweens.

When the player lands on a platform, I want to add the velocity of the platform to that of the player, so that the player can move independently, but still be affected by the platform beneath her.

The problem is, tweens don't have a velocity property (e.g. vx, vy). They move objects by updating the x and y positions directly.

Any help towards the right general approach would be appreciated.

Thank you!


Link to comment
Share on other sites

Thanks @ivan.popelyshev

After having tried my "addChild" approach, I can see how it can become problematic (having to manage removing it from the parent platform and back into the stage, etc.)

Side note: I am building the physics behaviors from scratch, because I find most physics engines to be too prescriptive. But I think my question is better for the more-general 2D Coding board.

Have a happy New Year!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...