one object dragging another object around

0 favourites
  • 5 posts
From the Asset Store
Use inertion of your movements to throw, rotate your objects and etc. Objects can interact with others while dragging.g
  • Hello! I'm struggling to make something like this:

    We have three objects interacting with each other: ufo, hook and worm.

    On mouse click UFO sends Hook in space to some max distance. If hook overlaps with worm then hook should attach itself to worm which is moving and dragging hook. Hook should set its angle to the angle of worm. And UFO should be dragged with the hook with its angle.

    I tried to do it using this new behaviour: Pin. But when I pin ufo to hook and hook to worm and I rotate hook toward angle of worm then only UFO rotates and I can't rotate hook. You can download this project here: speedyshare.com/files/30993894/spaceLassoTest.rar You send hook with the left mouse button and you have to send it so it hits the worm. In this version I added as few mechanics as I needed for this, because I'm really struggling to make it work...

    Maybe I should use physics instead?

  • dl.dropbox.com/u/1378330/lasooFix.capx

    Try that. I got rid of the behaviours and did it with events.

  • You could make "set position to hook.x, hook.y at imagepoint 1" (the place where you want the worm to be.

    Cheers

  • Thanks! It works great. I didn't want the hook wait until it gets it max length, so I changed it a little. I have one question, though:

    Each tick you set value: distanceFromHook to its real distance, but when you move ufo so it will follow the hook you have to subtract 200. Why distanceFromHook resets to almost zero when the hook sticks to worm and ufo instantly follows it?

    Spades Thanks! I know I have the possibility like this, but cow_trix methos is interesting because hook just sticks to the object in the point where it collided with it. But probably in the end sticking to one imagepoint will be better.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Each tick you set value: distanceFromHook to its real distance, but when you move ufo so it will follow the hook you have to subtract 200. Why distanceFromHook resets to almost zero when the hook sticks to worm and ufo instantly follows it?

    Sorry Samur, I don't quite understand. The variable distanceFromHook shouldn't reset to nearly zero. The reason I set the move amount to 200-distanceFromHook is so that the further away the UFO is from the worm, the faster it moves.

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