Top-Down Zoom via (Un)Lerp

Get help using Construct 2

Post » Thu Sep 26, 2013 6:31 am

CAPX: https://www.sugarsync.com/pf/D6025908_4317202_6928963

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 works...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!
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 791
Reputation: 15,148

Post » Fri Sep 27, 2013 6:00 am

*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.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
142
S
24
G
8
Posts: 791
Reputation: 15,148


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 15 guests