Proper MouseXY

Get help using Construct 2

Post » Mon Apr 01, 2013 5:00 pm

Hi, I wan't to ask how I can get an real position of mouse. I give You an example:
I made an event:
System > Every Tick :Action: Sprite Set Position (Mouse.X, Mouse.Y)

and then 2 other events:
Mouse > wheelup :Action: System > Set layout scale to LayoutScale + 0.1
Mouse > wheeldown :Action: System > Set layout scale to LayoutScale - 0.1

and now when i'm testing it and scaling the layout the Sprite position is at cursor but only on default scale. I'm trying to use absoluteX/Y but it not worked.

How I can get real mouseX/Y?

Thanks for reply, sorry for my engish. :)
B
9
S
2
G
1
Posts: 21
Reputation: 992

Post » Mon Apr 01, 2013 5:03 pm

Use mouse.x(layer) and mouse.y(layer) maybe?
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Apr 01, 2013 5:05 pm

maybe you could fix it by having your mouse sprite on it's own layer with layer scaling set to 0,0.
B
4
Posts: 5
Reputation: 710

Post » Mon Apr 01, 2013 5:16 pm

@sqiddster, I tried it and it doesn't works.

@kingpenguin, but in a moment I'll need to spawn objects at mouse pos on scaled layer. :/

Thanks for replies.
B
9
S
2
G
1
Posts: 21
Reputation: 992

Post » Mon Apr 01, 2013 5:42 pm

That's strange... You typed didn't type 'layer' did you? you have to type the actual name of the layer in quotation marks.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Apr 01, 2013 6:24 pm

Ahh, I used LayoutScale not LayerScale, now it works. Thanks. :)
B
9
S
2
G
1
Posts: 21
Reputation: 992

Post » Mon Apr 01, 2013 9:30 pm

by the way - to get a linear scaling, you should be multiplying/dividing by 0.9 or something instead of adding/subtracting. That way, it won't act strangely when the value approaches zero.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest

cron