zoom between two objects

Get help using Construct 2

Post » Wed Jan 15, 2014 4:08 am

Hello friends,

I can make the screen scroll to a location in the center of two objects, however I need to have the layer zoom out as they move further apart.

To scroll to center:

Scroll to position ->
Obj1.x+(obj2.x-obj1.x)*0.05
Obj1.y+(obj2.y-obj1.y)*0.05

Do I need to set an initial variable with the number Distance(obj1,x,obj1.y,obj2.x,obj2.y, then compare that with the current distance clamped so it does not get to small? I think I have the principle, but I am not sure how to do it right...

Thanks!
B
193
S
6
G
7
Posts: 213
Reputation: 10,203

Post » Wed Jan 15, 2014 6:57 pm

A bit of a guess here (not really used it much)

add the "scroll to" behaviour to both your objects - this should keep the screen centred between them.

setting the scale to the screen height (assuming this is smaller than the screen width) divided by the distance between the two objects should keep them in view.

You might not want to scale if they are too close so add something like if distance is greater than screen height

as you said you will also need to make sure the scale doesn't get too small.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Thu Jan 16, 2014 4:59 am

I found the plugin Magicam which works perfect, and it was just updated too!
B
193
S
6
G
7
Posts: 213
Reputation: 10,203


Return to How do I....?

Who is online

Users browsing this forum: Magistross, mtnboy22, Rable, Yahoo [Bot] and 6 guests