Make object attached to mouse rotate?

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • So, I've got the object attached to the mouse (every tick set object to Mouse.X and Mouse.Y), and now I'm trying to figure out a little bit of physics.

    Basically, when the mouse is holding still, I'd like the object to be "limp", that is, simply hanging upside down from the mouse. But, when the mouse starts moving, I'd like to make that object rotate, using the mouse as a pivot point, and also vary the speed and direction of the rotation depending on the velocity of the mouse and the angle of its movement.

    Is this possible? How do I do it?

    Thank you.

  • Does this help ?

  • Does this help ?

    Thanks for that. I tried it, and it works well, but when I tried to add it to my project, everything just sorta got screwed up. I even tried copying the events and actions EXACTLY (except disabled events) in a new project. The only difference was that I was using a text object instead of a Sprite. Well, it ended up staying put in the top left corner. Then I tried changing the text into a sprite, which caused the Obj (sprite) to appear briefly then disappear.

    Here are the .capx files: http://www.mediafire.com/?fu01wkrqwdefpnc,h52p66cd3dnwe2e

    I'm so confused. How could I screw this up, even when doing almost exactly what you did? >.<

    Thanks for your help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's not exactly the same in the sense that pivot object is covered by the sprite. In my example it mostly worked because both objects were not touching at first.

    I still don't understand what you're trying to achieve exactly.

  • I'm trying to make an asteroids type game, where you defend a planet from objects flying toward it. But, instead of a spaceship shooting weapons, you beat them back with a blunt weapon.

    I was trying to create a mace weapon effect, but that doesn't seem like that's going to work out well, since I can't get the weapon to rigidly stick to the mouse.

    Although, it could still work as a tank-like vehicle following the mouse and destroying any object it touches. Then again, I could also start over from scratch and make a platformer. Not sure which direction to take this now.

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