How do I adjust layout size based on character positions.

Get help using Construct 2

Post » Fri Jan 22, 2016 1:03 pm

I'm working on a brawl/smash sort of game and I have a camera with the scroll to function with a lerp.
When a character is almost at the edge of the view I want the camera to zoom out (Layout size) but the only way I can find is to set the layout size, not to adjust it per second or tick. Does anyone have any ideas how to do this?
B
3
Posts: 9
Reputation: 193

Post » Fri Jan 22, 2016 1:12 pm

You can change the layout scale over time.

Every tick->Set layoutscale to lerp(layoutscale, target, 5*DT)

Target is the layout scale you're shooting for.

Alternately, you could also add or subtract to it over time until a certain condition is meet.

If layoutscale >0.5 ---> set layoutscale to layoutscale-0.2*DT

Meaning it will subtract 0.2 gradually per second until it reaches about 0.5.
B
103
S
38
G
19
Posts: 962
Reputation: 17,986

Post » Fri Jan 22, 2016 1:19 pm

Oh god, so dumb of me that I let a simple lerp slip my mind (since I used it for the camera too).
Thanks I'll post back if it has the effect I need, or not, or better I'll just edit this post if there are no more new posts.

Edit: It worked, First I calculated the distance between the characters and stored it into a variable and used that variable to zoom out based on the distance between those objects (players) using the lerp. Thanks, this problem is solved rather quickly.
B
3
Posts: 9
Reputation: 193


Return to How do I....?

Who is online

Users browsing this forum: justifun, tarek2 and 5 guests