Throw an object with the mouse

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I'm making a point and click puzzle game. How do I pick and object up wit the mouse, and using mouse momentum, throw it? I can pick it up, move it around, play with physics to make it fall like a rock, and tumble like a rock when it hits objects, but as soon as I let go of the mouse button, it just drops. How do I give it force? Impulse? (whichever is best) in the direction the mouse is moving?

    There are some answers from 4+ years ago, but all the links to their code are not working anymore.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use Touch instead of the Mouse. You will still be able to control it with the mouse, but Touch plugin also has SpeedAt() and AngleAt() expressions.

    You can use them to apply an impulse at angle, for example:

    On Touch End -> Sprite apply impulse min(100, Touch.SpeedAt(0)) at angle Touch.AngleAt(0)

    But of course you will need to experiment with values.

    Instead of physics you can use Bullet or some other behavior.

  • Ok, awesome. I'll try that out

  • This worked perfectly. Thank you.

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