Top-Down Zoom via (Un)Lerp

0 favourites
  • 2 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • CAPX:

    The game is going to be a top-down view. The levels will be made out of different layers, or floors in a building. Some floors will obviously be hidden due to design. Other floors may consist of catwalks or lofts or large open spaces, which allow the lower floors to be visible.

    What I'm trying to set up is where going up and down stairs, for example, will 1) cause the character to move between floors, and 2) make the floors zoom in and out (by way of Layer Scale). (It's something I'll address later when multiple floors become too close to the screen, obscuring view of lower floors, namely the one the player is on. First I just need to get something set up.

    What I've been attempting is to use Lerp and Unlerp to create a smooth zoom effect, rather than just the sudden adjustment. The player will always appear the same size. Unfortunately, it doesn't seem to be working as I envision it.

    Additionally, in debug mode, I noted that the scale values of the layers never go back to their previous values - granted, with multiplication and division of many numbers, it's gonna be hard to do. I'm also seeing the same problem when I add or subtract values from the scale. This is a problem because as you zoom in and out, the value will never be quite the same. I'm worried that this will lead to inaccurate zoom levels (in beta testing later on).

    It was suggested to me to try using a greater-than/less-than event test to check when a scale value is at its right amount...

    If LayoutScale is < or > x | Set LayoutScale to LayoutScale + y*dt

    It has the effect I want based on the capx shared with me.

    I'm just wondering if there's a solution while using Lerp. Any suggestions? Thank you much!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • *bump* I also accidentally saved over the file with other tests I was trying. I've since restored the file to what I had initially been working with, so you can see what I was trying to figure out.

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