Make object attached to mouse rotate?

Get help using Construct 2

Post » Fri Feb 03, 2012 3:28 am

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.
B
10
S
2
G
5
Posts: 49
Reputation: 3,081

Post » Fri Feb 03, 2012 6:42 am

Does this help ?
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Fri Feb 03, 2012 10:00 pm

[QUOTE=Kyatric] Does this help ?[/QUOTE]
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.
B
10
S
2
G
5
Posts: 49
Reputation: 3,081

Post » Fri Feb 03, 2012 10:33 pm

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.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Fri Feb 03, 2012 11:16 pm

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.Joshua2012-02-03 23:17:40
B
10
S
2
G
5
Posts: 49
Reputation: 3,081


Return to How do I....?

Who is online

Users browsing this forum: Magistross, zatyka and 21 guests