How do I control the zoom limit of the camera?

Get help using Construct 2

Post » Sun Apr 10, 2016 10:43 pm

Hi everyone, first of all, and thank you all for your help.

I've been working on a code for the camera to follow both players on the screen, zomming in and out as they get closer or further away from each other.
This is the code i used:

Now there's three things i need to fix:
1- Whenever the sprite plays an animation (for example: punching), the camera kinda zoom's a lil bit quick and goes back.
2- When the players are on the screen limits away from each other, the blank space around the screen, appears... wich that leads me to the next question.
3- How can i give the zoom a limit? For both, close and near views?

Thank you all guys, you're great!
Posts: 1
Reputation: 302

Post » Mon Apr 11, 2016 3:44 am

1: I might consider finding a way to do this all without including the player/enemy widths. It sounds like your frames are different and that's causing the issues.
2-3: You can use clamp to force it to stay within a certain range. That will give a lower and upper limit. If you're trying to just make it not zoom so far the edges of the map show, you could add a condition that compares the edge of your layout to the viewport edge. Don't zoom out any more if they're too close, for instance. I'd type out psuedo-code for that, but it's tough without knowing your layer and layout settings, but I think you should be able to whip something up from that.
Posts: 962
Reputation: 18,026

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 49 guests