Dynamic Camera Pan/Zoom based on multiple objects

  • 10 favourites



2,460 visits, 4,578 views


This tutorial hasn't been translated.


The Intro

For the recent C3Jam

, I worked on a game called BLU. Its fast-paced strategy platformer with AI enemy bots that use platformer pathfinding. In the game, you control a blue square and try to paint the arena blue, while 3 enemies with different skills and objectives, try to kill you or undo your work. Random power-ups spawn which give your character special abilities for a short time.

Rather than having a static camera showing the view of the entire arena at all times, I wanted the camera to be dynamic to achieve the following objectives:

o Focus on all active objects (player, bots, powerups) at same time

o Zoom in when objects are closer

o Zoom out when objects are apart

o Pan and follow all active objects

The result was something like this...

Subscribe to Construct videos now

You can play the game here

In this tutorial, we will see how this was done.


This tutorial builds on top of the concepts explained in another tutorial I had written for "Smooth scrolling with inertia". Please go through that tutorial first and come back here.


  • Order by
Want to leave a comment? Login or Register an account!