How do I make a smooth zoom?

Get help using Construct 2

Post » Mon May 05, 2014 12:57 am

Hi!

I'm making a sidescrolling "contra "game.
what i want is the game to have a different zoom value in different parts of the stage.

something like this:
Image

when the character is in contact with the "zoom value 1" (invisible) sprite and walks right, the zoom slowly scales to a certain value to stay like that until the char hits another zoom value sprite. in this case, "zoom value 2" would scale it to a bigger scale. is that possible?
B
5
S
1
Posts: 92
Reputation: 609

Post » Mon May 05, 2014 2:05 am

B
101
S
32
G
12
Posts: 1,549
Reputation: 21,993

Post » Mon May 05, 2014 11:21 am

This thread have exactly what you want :
Search for title, because i can't post links:

"Smooth layout scale?"
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,165

Post » Mon May 05, 2014 10:25 pm

thanks! but I search that (or some varibale) and nothing appears.
B
5
S
1
Posts: 92
Reputation: 609

Post » Mon May 05, 2014 10:46 pm

If you want to stay with non 3rd Party plugin with construct 2, you can have a look to the system action "Set Layout Scale".

To have it smooth, instead of setting it to a constant, you can set it to :

When zooming In:clamp(LayoutScale+Scale_Speed, 0, Final_Scale) ; Scale_Speed being the speed of the zoom, and Final_Scale the value you want to have

When zooming Out:clamp(LayoutScale-Scale_Speed, Final_Scale,LayoutScale) ; Scale_Speed being the speed of the zoom, and Final_Scale the value you want to have

Just a suggestion thought
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Tue May 06, 2014 11:55 am

This for the zoom out:
Every tic ------ lerp(layoutscale, 0.6, 1*dt)

Zoom in:
every tic ---------- lerp(layoutscale, 0.9, 1*dt)
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,165

Post » Tue May 27, 2014 3:03 am

well! finally i had time to try this. Sorry for the huge delay.

I still doesn't work. I've tried both methods suggested here.

First, I did this:

-when "PLAYER", is olverlapping the sprite "ZOOM1", set layerscale:
-layer 1
-scale:
clamp(LayoutScale-1, 0.6,LayoutScale)

This was the result: when the player stepped inside that sprite the scale went to 0,6, but did it instanctly, without a smooth zooming, and when the player got out of the zone it returned to the normal scale.

then I did the other one:

-when "PLAYER", is olverlapping the sprite "ZOOM1", set layerscale:
-layer 1
-scale:
lerp(layoutscale, 0.9, 1*dt)

It did the exact same result. the change was instant.

What am I doing wrong?
B
5
S
1
Posts: 92
Reputation: 609


Return to How do I....?

Who is online

Users browsing this forum: maddy467, work3 and 8 guests