How do I get "Layer To Canvas" to work with full screen?

0 favourites
  • 12 posts
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • EDIT: Problem solved, I was just being sloppy when dealing with a very complex need for camera and scrolling control for a specific level.

    Hi,

    This is so counter-intuitive I think it's a bug. Layer to Canvas is supposed to convert the coordinate of something in the specified layer to what would be the equivalent on-screen position.

    If your entire project is set to "leterbox scale", then clearly everything is designed to scale proportionally so that all on-screen and in layout positions and sizes remain identical no matter how someone changes the size of the window of goes to or from full screen.

    YET, in my project, I used "Layer to Canvas" successfully to carefully control the on-screen position of an object, BUT it only behaves properly when the project is exactly at its default scale (1 to 1-pixel ratio, no scaling whatsoever). As soon as I go full screen or enlarge the window the position of the object is clearly no longer calculating properly.

    Is this a bug or is there any ration reason for "Layer to Canvas" to no longer actually convert "Layer to Canvas" when the screen is enlarged?

    Either way, any idea how I can work around this?

    Do I really need to make a big formula computing what ratio the window is stretched to and add that ration to my "Layer to Canvas" formula?

    Thanks for any help, hints, or ideas.

  • Try using letterbox integer scale.

    Letterbox scale dos not have set proportions and is used as a generic for when you don't know a screen size being used.

    Letterbox integer should keep averything in scale but I haven't tried it with layer scaling.

  • Thanks but sadly it made no difference. It's as though Construct 2 is counting real monitor pixels instead of the enlarged pixels for "canvas" coordinates.

  • Well hmmmm?

    You can try setting the scale of objects to layer scale in the same event.

    Layout scale does not work well in C2 and requires whole numbers or acts scre

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well hmmmm?

    You can try setting the scale of objects to layer scale in the same event.

    Layout scale does not work well in C2 and requires whole numbers or acts screwy and I bet this is a related problem.

  • I'm never scaling any layout, only calculating position to place an object on a layer set to zero y Parallax to match an object's position which is on a layer set to parallax 100 (percent).

    The only scaling is being done to everything via "letterbox integer scale". Everything works perfect at 1 to 1 scale for the windows, if I stretch the window or full screen then the object in question teleports off screen.

  • Well I don't know what to tell you then. Seems like this same question has come up like 4 times in the last month?

  • Not sure what you exactly want. But lets show you the basics, and a problem that can arise with it.

    In this capx, you see a paralaxed and a non paralaxed layer.

    With some imagination you see a little player with a big gun.

    The gun should always point to a fixed place on the screen.

    The parallax happens because of the scroll to behavior on the player.

    For that we need a fixed layer to place that object on (the green cross).

    Now we translate those positions to positions on the paralaxed layer.

    The black cross shows the result, but is not needed.

    This are the basics.

    https://www.dropbox.com/s/3jxmjiqcvw3ls ... .capx?dl=0

    But as you see, and maybe that is also you problem, with a scaled layer, it is not exactly spot on.

    Well in fact, it is, but it is to late.

    The scroll behavior moves the layer on the very end of the tick.

    So we, in fact, when we start measuring, comparing, and then set the position, we do it before the parallaxing happened.

    How do we solve this ? We just do the parallaxing on the exact moment that we want it to happen.

    https://www.dropbox.com/s/vgftqcvdgrt1t ... .capx?dl=0

  • That's very helpful of you, 99Instances2Go. It's very close to what I need to do, BUT I need to do the opposite. I need to make something on a FIXED layer match the position of a moving object on a PARRALLAXED layer, your example makes the position of something on a PARRALLAXED layer match the position of an object on a FIXED LAYER.

    I've no lock reversing your example to do what I need EXCEPT at zero window enlargement, as soon as I go full screen or enlarge the browser window, the positions get more and more off sync as the window gets bigger or smaller than 1x1 ratio.

    Side note: I only care about Y positions, so X coordinates are irrelevant for my needs.

    Any ideas?

  • Nothing opposite. Exactly the same.

    https://www.dropbox.com/s/rc7sgjlrp29yk ... .capx?dl=0

    Want them to have the same size too, set scale rate for COPY to 100.

  • Now it is your chance to be 'very helpful'. Drop a capx.

  • Thanks again. After posting my previous reply I stayed up all night figuring it out and eventually realized, (as is often the case when thinking there is a bug in a c2 feature ) that I had two events at different points in the event sheet which were causing the actual conflict.

    I now have it working properly, in large part thanks to your help.

    Cheers.

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