How do I position sprite on mouse

Get help using Construct 2

Post » Tue Mar 22, 2016 5:10 pm

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
Image
the red circle is my mouse position and the crosshair a way off from it.

how to solve this ?
B
5
S
1
Posts: 10
Reputation: 341

Post » Tue Mar 22, 2016 5:27 pm

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).
B
32
S
7
G
4
Posts: 397
Reputation: 4,589

Post » Tue Mar 22, 2016 6:10 pm

Message: himageki can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
grigrizljac wrote: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).


thanks for reply :D
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
B
5
S
1
Posts: 10
Reputation: 341


Return to How do I....?

Who is online

Users browsing this forum: vegapomme27, Yahoo [Bot] and 8 guests