How do I detect Mouse speed?

Get help using Construct 2

Post » Sat Feb 25, 2017 7:35 pm

I'm trying to basically get it so you swing a sword from a pivot point (which is attached to the Mouse movements), but the sword can only affect enemies when it is swung at a certain speed, so that you can't move the mouse a pixel and an enemy be destroyed if it's touching the sword, you actually have to rotate the mouse enough to cause it. I've tried adding the custom movement and 8 direction behaviours to the sword to see if it can compare speed, but it doesn't seem to register the mouse movement's effects as the custom or 8 direction movement.

What's the best way to go about this? :(
B
10
S
2
G
1
Posts: 36
Reputation: 709

Post » Sat Feb 25, 2017 8:39 pm

You can't check acceleration with mouse but you can with touch and that should give you the same number.

Add touch to your layout.

You need a global variable to use for the touch speed on the Y axis.

I used DoubleTap for my variable.

Image

You can check speed with and without gravity or you can check angle of motion of touch.

I haven't trued it but should work.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Thu Mar 02, 2017 11:56 pm

lamar wrote:You can't check acceleration with mouse but you can with touch and that should give you the same number.

Add touch to your layout.

You need a global variable to use for the touch speed on the Y axis.

I used DoubleTap for my variable.

Image

You can check speed with and without gravity or you can check angle of motion of touch.

I haven't trued it but should work.


That would work, but then I'd have to find a way to make a simulation of the touch and pin it to the movement of the mouse?
B
10
S
2
G
1
Posts: 36
Reputation: 709

Post » Fri Mar 03, 2017 12:15 am

mongoose665 wrote:
lamar wrote:You can't check acceleration with mouse but you can with touch and that should give you the same number.

Add touch to your layout.

You need a global variable to use for the touch speed on the Y axis.

I used DoubleTap for my variable.

Image

You can check speed with and without gravity or you can check angle of motion of touch.

I haven't trued it but should work.


That would work, but then I'd have to find a way to make a simulation of the touch and pin it to the movement of the mouse?


No you just have to include both mouse and touch in your layout and they both operate using the same X and Y coordinates but Touch has readings for speed that mouse does not have.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790


Return to How do I....?

Who is online

Users browsing this forum: lordsas, mekonbekon and 70 guests