How do I make objects go ACCURATELY to mouse position?

Get help using Construct 2

Post » Mon Mar 17, 2014 11:21 am

Hi,

I'm setting one of my objects to go to Mouse.X, Mouse.Y every tick, but it doesn't go accurately to the mouse pointer position.

What am I doing wrong?

Is it something to do with scaling of the layout?

Cheers,
Martin
B
6
S
2
Posts: 18
Reputation: 594

Post » Mon Mar 17, 2014 11:38 am

Where does it go instead?
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Mon Mar 17, 2014 11:43 am

It's accurate when in the centre of the screen. When at the edges of the screen the sprite overshoots the mouse pointer and appears at a more peripheral position (or off the screen).
B
6
S
2
Posts: 18
Reputation: 594

Post » Mon Mar 17, 2014 11:55 am

Strange... I just tried it and it works perfectly in my project. Maybe you can provide a capx?
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Mon Mar 17, 2014 12:23 pm

Are you doing anything with layer parallax or scale or scroll to ?

Please post a basic capx that show this ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Mon Mar 17, 2014 11:43 pm

Thanks Guys,

here's the Capx - sorry it's so big - it's because of the huge background image - it's the main feature of the project and I don't really want to lose the great detail. (Any tips for retaining this detail and improving performance gratefully received!).

https://dl.dropboxusercontent.com/u/437 ... 0Capx.capx

You'll see that the mouse pointer misalignment worsens as you zoom with z and x. I've tried various ways of adjusting mouse.x and mouse.y by factors related to the scale, but to no avail.

Cheers,
Martin
B
6
S
2
Posts: 18
Reputation: 594

Post » Tue Mar 18, 2014 5:19 am

@Nerdsville

with scaling/fullscreen modes mouse.x doesn't always match correctly
but if you do mouse.x("layername") it will return the mouses position on that specific layer

you can also do mouse.x(0) where 0 is the layer ID
B
28
S
8
G
1
Posts: 469
Reputation: 4,683


Return to How do I....?

Who is online

Users browsing this forum: koops, Slug101 and 7 guests