How do I position sprite on mouse

0 favourites
  • 3 posts
From the Asset Store
Create your game with this complete pack of images and animations!
  • i want to make my crosshair position on my mouse, so i make the code

    Every tick >> crosshair set position to mouse. AbsoluteX, mouse.AbsoluteY

    but it ended up like this

    the red circle is my mouse position and the crosshair a way off from it.

    how to solve this ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are two ways of doing this.

    1. On start of layout -> Mouse|Set cursor from sprite (in this case, make sure the crosshair sprite is not larger than 64x64).

    2. Every tick -> crosshair set position to X: Mouse.X, Y: Mouse.Y (make sure you set to X and Y, not AbsoluteX and AbsoluteY)

    For the first option, see here for more info: https://www.scirra.com/manual/114/mouse (under Mouse Actions).

  • There are two ways of doing this.

    1. On start of layout -> Mouse|Set cursor from sprite (in this case, make sure the crosshair sprite is not larger than 64x64).

    2. Every tick -> crosshair set position to X: Mouse.X, Y: Mouse.Y (make sure you set to X and Y, not AbsoluteX and AbsoluteY)

    For the first option, see here for more info: scirra.com/manual/114/mouse (under Mouse Actions).

    thanks for reply <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

    the first option is work really well.

    but the second option is weird, because i am already try that before. the crosshair actually spawn under my cursor and its WAY off from the Absolute position. its weird

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