[solved] Incorrect scaling

Get help using Construct 2

Post » Mon Apr 21, 2014 11:50 am

Hi there.
I'm trying to make zoom capability, but one of my layers seems to scale incorrectly, and I'm not sure why.
I have a UI layer and above that a cursor layer, which has my cursor sprites on it. The sprite has its position set to the mouse.x and mouse.y coordinates every tick.
But when I change the layout scale, the mouse position and the sprite are in different places. At the middle of the screen it doesn't do this as much. I tried setting the layer scale rate to 0 but to no effect.

Edit:
Looked at the mouse coordinates, looks like they change based on the layout scale. Made the sprite set to the mouse position though, using cursor x = (mouse.x - (mouse.x - scrollx) / 2) and the same for y.
Last edited by Sumyjkl on Tue Apr 22, 2014 1:59 am, edited 1 time in total.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Mon Apr 21, 2014 3:09 pm

Mouse.x and Mouse.Y refers to the coordinate on your layout, so it will also take scaling, etc. into account. So yes. ;)
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459

Post » Mon Apr 21, 2014 3:22 pm

You can use Mouse.X("layer name") and Mouse.Y("layer name") to get coordinates for specific layer
ImageImageImageImage
B
157
S
64
G
41
Posts: 2,590
Reputation: 34,640

Post » Tue Apr 22, 2014 12:51 am

Ah, thanks guys, I'll give that a try shinkan.

Edit: Worked for the cursor, but since I have objects on other layers that I drag and drop, it seems to conflict there giving the same result as before. I might have to just set a global variable for mouse/touch position. I'll mess around with it a little more first though.

Solved: I used mouse("layer") on a layer that was scaled and it worked fine.
B
42
S
14
G
3
Posts: 165
Reputation: 5,115


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests