0 Favourites

How do I detect Mouse speed?

  • 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?

  • 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.

    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.

  • 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.

    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?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • > 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.

    >

    >

    >

    > 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.

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