I am developing a game where I need to zoom in entire map also I can be able zoom out. I have created a tilemap using tiled software and rendered it using phaser.js. How can I add this function to my game?


First you need to setup your camera like this:

this.camera = this.cameras.main.setBounds(0, 0, 640, 340);

// make the camera follow the player  

// set background color, so the sky is not black  

And you can set up the zoom like this:

2, //zoom distance   
1000 // duration/speed of zoom

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.