How do I control the zoom limit of the camera?

0 favourites
  • 3 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • 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!

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you so much! I forgot to tell you it worked!

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