How do I Zoom in Layout, Zoom out Layer

Get help using Construct 2

Post » Sat Jul 25, 2015 7:38 pm

I'm trying to do a layout zoom in while keeping the UI layer normal. I have tons of layers and every stage has different layers, so to avoid zooming in on 200 layers simultaneously I'm trying to do the following:

Zoom in Layout : LayoutScale+0.1*dt
Zoom out Layer "UI" : LayerScale("UI")-0.1*dt

if LayoutScale > 1.2
Set LayoutScale 1.2
Set Layer "UI" Scale to 0.8

While this looks...okay, sometimes it doesn't match up exactly at the end. Can anyone think of a better way to do this?
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Sat Jul 25, 2015 8:18 pm

that's only a maths problem:
at first, the scale of your layer "UI" is 1
then you multiply it by 1.2
then you multiply by 0.8
==> 1*1.2*0.8 = 0.96 different from 1 !

instead of multiplying by 0.8, you should multiply by 1/1.2 (ie 0.83333333...)
B
8
S
1
Posts: 76
Reputation: 628

Post » Sun Jul 26, 2015 4:32 am

@yapiiiii - oh of course! So does that mean the final UI scale should be 0.83333 instead of 0.8?
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Sun Jul 26, 2015 11:14 am

yes, or more exactly 1/1.2
B
8
S
1
Posts: 76
Reputation: 628

Post » Sun Jul 26, 2015 5:46 pm

@yapiiiii - great thank you!
B
40
S
12
G
1
Posts: 532
Reputation: 4,147

Post » Wed May 03, 2017 6:02 pm

I don't get this. How do I write this math formula when I lerp the "UI" layer?
B
9
S
1
G
1
Posts: 42
Reputation: 1,213

Post » Wed May 03, 2017 7:32 pm

like this:

lerp(minZoom, maxZoom, percentageBetweenThem)

like:

lerp(0.01,100,0.56) meaning 56% of the way between LayerScale 0.01 and 100.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Wed May 03, 2017 8:47 pm

@Plowman

Alternatively, you could make the UI layer not scale at all when you scale the Layout by just setting it Scale Rate to 0 in the Layer properties
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
33
S
9
G
7
Posts: 450
Reputation: 6,780

Post » Wed May 03, 2017 9:29 pm

Ah, now that's a much easier and better way to do it - thanks!
B
9
S
1
G
1
Posts: 42
Reputation: 1,213

Post » Fri May 05, 2017 12:34 am

thanks! this helped me with my latest project.
Play Ball Walker App Store | Google Play | Amazon
Image
B
30
S
5
Posts: 116
Reputation: 2,088


Return to How do I....?

Who is online

Users browsing this forum: evillair, gamecorpstudio, jorgmaquoi, ultrafop, Yahoo [Bot] and 19 guests