How do I pin a sprite to the mouse cursor with no delay

0 favourites
  • 4 posts
From the Asset Store
Mouse cursor is something that the player controls and sees all the time, that's why it is so important to make it cool!
  • I need to actually pin a sprite to the mouse cursor and not just change what the cursor looks like for code specific reasons.

    Using either the Every Tick or Pin function causes the sprite to drag the faster the cursor goes.

    I need this because I want a sprite to change directions when clicking depending on what side of the sprite the cursor is on, and there's no way to determine that using the mouse object that I can see.

    Thanks for any help

  • Since it uses browser, there will always be lag/delay to the mouse movement. This can't be solved unfortunately.

    But you could check the previous mouse position with the current position by storing the previous x,y in variables, then comparing them to the new values to find which direction the cursor has moved.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey thanks for the info.

    I'm not sure what you mean about comparing the values though.

    Is that a way to tell which side of my Player Sprite the cursor is on?

  • Oh, I misread it.

    You can compare the sprite x position with the mouse x position, to check if one is greater or less than the other. Then mirror/unmirror the sprite based on that condition.

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