Object follow mouse path with acceleration

0 favourites
  • 4 posts
From the Asset Store
Create your game with this complete pack of images and animations!
  • Heyho!

    I would like make a test game, about the idea similar to Draw Race 2.

    Link:

    Subscribe to Construct videos now

    I already found the basics from this forum post with follow mouse path:

    Forum Link

    I use for start ramones's rocketFollowPath_fixed.capx (r103.2)

    However, I would like to ask from your opinion, how should I create a "path follow" behavior with acceleration based on the mouse speed movement.

    I had an idea with comparing global variables which stores mouse.X and Y values from in every X seconds?

    Like distance between actual Mouse.X and past Mouse.X divided by time, but how should I add to change the path?

    I would like to achieve that, if I make a fast 90 degree change, then the object shouldn't follow the path that strict. I hope someone has a good idea to achieve this.

    Have a great day!

  • Hy again!

    I would like to trace the movement of the mouse within a criteria (like when the left mouse is down).

    like: Frame 1. X Y, Frame 2. X Y etc..

    Or which option do I have, if I want to compare the distance travelled by the mouse between time 1 and time 2?

    I hope someone has a good solution for this.

    Cheers!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Something like this?

    create 2 variables: OldMouseX and OldMouseY

    on mouse left button down

    every x seconds

    -

    set object speed to distance(mouse.x,mouse.y,OldMouseX,OldMouseY)

    set OldMouseX to mouse.x

    set OldMouseY to mouse.y

    You have to set the speed before setting OldMouseX and OldMouseY.

  • Thank you LittleStain for the reply and solution!

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