How do I drag and throw objects and make them rotate?

0 favourites
  • 2 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • I'm looking to drag objects while holding down the touch gesture in a 2D zero gravity world (i.e. a top down view of a desk with objects on it). My problem is that I can't figure out how to make the objects continue their movement a bit after I've let go of them (make them slide across the table based on the direction and speed of the drag), and also how to make them rotate according to at which point of the object I grab them from.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "On touch end" event you can get touch speed and touch angle and use these values to apply momentum to the sprite. For example: "Set Bullet speed to Touch.SpeedAt(0)/2, Set Bullet angle of motion to Touch.AngleAt()". Or, if you are using Physics - "Apply impulse .. at angle .."

    Rotation is trickier. You can use angle(sprite.x, sprite.y, touch.x, touch.y) and distance() expressions to get the angle and distance of the grab point relative to the sprite center. Say, if angle() is counter-clockwise from the angle of motion, rotate object clockwise. Set rotation speed depending on the distance. With physics - set angular velocity.

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