Dynamic zoom with a loop effective?

0 favourites
  • 2 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Greetings Construct 2 crowd!

    I´m not a coder so please bear with me if I dont think

    like one! I try to solve my problems by thinking simply

    logical and then get this logic done with the tools I have

    at my fingertips in construct.

    Ok here´s what I´m at.

    I want to create a dynamic camera zoom and a dynamic

    timescale so that I can create effects like seen on Peggle

    when the ball gets near the last brick. And so far everything

    is working nearly perfect. My solution for now:

    Setting up 4 globals

    1: DynaZOOM

    2: DynaZOOM_rate

    3: DynaTIME

    4: DynaTIME_rate

    For the timescale this is very easy to do with just one


    EVENT: System - Every tick

    ACTION: System - Set time scale to lerp(timescale, DynaTIME, DynaTIME_rate)

    With it I can control the timescale with just 2 values. DynaTIME to set

    the timescale and DynaTIME_rate to set the interpolation or "easing"

    to get a smooth effect.

    No for the zoom it gets a little more complicated. First I tryed it with layout scale

    but that simply scales all layers. But I want my GUI and HUD layers to stay

    at 100% size so that only the level gets modified in size.

    Now I´m going with layer scale. It´s working like a charm but I have 2 ways

    of doing it and my question ist: Am I bogging down performance with my

    loop solution?

    I have 8 layers where all the action takes place. Maybe I will need more

    so the zooming has to be flexible.

    Solution 1:

    EVENT: System - Every tick

    ACTION: System - Set layer 1 scale to lerp(LayerScale(1), DynaZOOM, DynaZOOM_rate)

    Set layer 2 scale to lerp(LayerScale(2), DynaZOOM, DynaZOOM_rate)

    Set layer 3 scale to lerp(LayerScale(3), DynaZOOM, DynaZOOM_rate)


    Set layer 8 scale to lerp(LayerScale(8), DynaZOOM, DynaZOOM_rate)

    Solution 2:

    EVENT: System - Every tick

    System - For "" from 1 to 8

    ACTION: System - Set layer loopindex scale to lerp(LayerScale(loopindex), DynaZOOM, DynaZOOM_rate)

    Both solutions work but I prefer solution 2. If I need more layers I just

    have to change one number in this loop. My first question is:

    Do I get a performance drop if I use the loop solution or is it basicly the same?

    And now my second one. I´m very satisfied with DynaZOOM and DynaTIME but

    if my player sprinte is in one corner of the layout, the scrollto function fails.

    I can walk out of the window and the camera is not following my character.

    I think because the scaling is centered. Is there any way to manually push my

    scrollto to the player sprite when zoomed in?



  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well I found the Layout option "Unbounded scrolling" and that

    keeps the game window centered to the character sprite when

    zoomed in. But zoomed at 100% I can see outside the game area

    which is the meaning of "Unbounded scrolling" so that is not what

    I´m looking for. Well maybe I will keep this problem for later...

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