How do I make a smooth zoom?

0 favourites
  • 7 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • 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:

    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?

  • Check out the MagiCam plugin.

  • This thread have exactly what you want :

    Search for title, because i can't post links:

    "Smooth layout scale?"

  • thanks! but I search that (or some varibale) and nothing appears.

  • 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

  • This for the zoom out:

    Every tic ------ lerp(layoutscale, 0.6, 1*dt)

    Zoom in:

    every tic ---------- lerp(layoutscale, 0.9, 1*dt)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

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