"Zoom out/in" when overlap

  • I've reviewed several posts in the Forums here but couldn't find anything that made sense or was exactly relevant to my case...

    I'm working on a Zelda-esque (old school) mobile game in which, when the main character overlaps the candle bloom, the camera will zoom out via scaling the layers out to show more of the level.

    The event line reads:

    If Character is overlapping CandleLight set Layer Scale to 0.5

    The affected layers (currently, ONLY layer "Walls") have a scale rate of 50%.

    What I am hoping to do is gently zoom the camera out/in rather than have it instantly appear at its updated scale. The problem I'm having is that when the Character overlaps said candle light, nothing happens.

    The layout's Unbound Scrolling is checked and I tested it with unsuccessful results with it unchecked, as well.

    I don't want to zoom out all the layers (ie: HUD) - just the ones related to the level design, etc.

    Any suggestions on what I may try?

    Here is the C3 file: https://www.dropbox.com/s/r76jkxweizsllfe/busters%20escape%20v5%20.c3p?dl=1

    The event line is 221.

  • You need 2 Global Variables :

    - currentScale

    - MAX_SCALE(Constant Number)

    Example for ZOOM IN :

    If Player overlaps Candle ->

    Sub-Condition : currentScale < MAX_SCALE :

    Add dt to currentScale

    Set layer X scale to currentScale

    If Player NOT overlaps Candle ->

    Sub-Condition : currentScale > 1 :

    Subtract dt from currentScale

    Set layer X scale to currentScale

    There is my screenshot which I made with Construct 2:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you! A simple lerp-style set of instructions it looks like. I'll give that a go and let you know how it works.

  • Maverick1912 - Okay! Good news! It worked. And, actually, I discovered that I had accidentally had the wrong object selected to test if it was overlapping the test object to initiation the zoom. That's all fixed, too.

    But now I have another matter... When the layers in question zoom out, the collision barriers of the walls seem to "extend" past the scaled out images. I can move my character around, but the walls don't necessarily seem to have gotten smaller. I can't get up on the edges like I can when the scale is normal.

    Any idea what's causing this?

  • HA! Nevermind. I figured it out.

  • Good to know.

    Can you share the issue and solution in case someone meet them ? :D

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