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

Get help using Construct 2

Post » Fri Mar 24, 2017 12:25 am

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.
Last edited by Brashmonkey on Sun Mar 26, 2017 11:42 am, edited 1 time in total.
B
49
S
9
G
4
Posts: 426
Reputation: 7,071

Post » Fri Mar 24, 2017 1:21 am

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.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,800

Post » Fri Mar 24, 2017 2:03 am

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. :(
B
49
S
9
G
4
Posts: 426
Reputation: 7,071

Post » Fri Mar 24, 2017 2:22 am

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
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,800

Post » Fri Mar 24, 2017 2:22 am

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.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,800

Post » Fri Mar 24, 2017 2:36 am

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. :(
B
49
S
9
G
4
Posts: 426
Reputation: 7,071

Post » Fri Mar 24, 2017 3:02 am

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?
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,800

Post » Fri Mar 24, 2017 1:09 pm

@Brashmonkey

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
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sun Mar 26, 2017 2:20 am

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?
B
49
S
9
G
4
Posts: 426
Reputation: 7,071

Post » Sun Mar 26, 2017 9:59 am

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to How do I....?

Who is online

Users browsing this forum: 8tomo8, brunopalermo and 10 guests