[solved] Incorrect scaling

0 favourites
  • 4 posts
  • 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.

  • Mouse.x and Mouse.Y refers to the coordinate on your layout, so it will also take scaling, etc. into account. So yes.

  • You can use Mouse.X("layer name") and Mouse.Y("layer name") to get coordinates for specific layer

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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