Help with layer scale rate compensation.

0 favourites
  • 7 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I have 2 layers, one with a scale rate of 0%, and another with a scale rate of 50%.

    Now, if I zoom out, that is, set the layout scale to something like 50% does this happen?

    Or does this happen?

  • I believe its the first.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's depending from the window/layout-size and where the center-point (scroll to) is.

    When the layout-size is bigger then the window-size and you scroll to the center of the layout (or any other place, except lop-left), the first version will happen.

  • Great, thanks for the confirmation. I had tried placing large tiled backgrounds that filled each layer to compare, but it wasn't obvious to me what was happening.

  • I'm going to add another question to this, relating to my first question.

    So, in my game, I have a minimap. The minimap is 200x200. When the mouse is over the minimap, I get it's position on the minimap treating the topleft of the minimap as 0,0.If the mouse is on the very center of the minimap, it is at 100x100.

    I call this number mouse_minimap_x and mouse_minimap_y respectively for each axis.

    Then what I do, is take that number, and do mouse_minimap_x/200. This gives me a ratio. So if the mouse were in the very center of the minimap, I would get 0.5.

    I call this new number the mouse_minimap_ratio_x. I take this and do mouse_minimap_ratio_x*layoutwidth. This tells me where to move the camera on the layout. Which, in this case, would be to the very center of the layout.

    This all works fine normally, the problem arises when I set the layout scale to anything other than 100%. The camera is moved to the wrong position, often very far offset from where it should be.

    To solve this, I tried making a new layer, with a scale rate of 0, and put the camera on that, but that changes nothing.

  • This pops to mind ...

    ratio = mouse_minimap_x/(200*layerscale)

  • Yeah, I think that might have worked. It turns out that my problem was something else entirely though this time. I was using viewportleft(layer) but with the wrong layer. One that had a scale rate greater than 0. Thanks for your help though.

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