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 this.camera.startFollow(this.player); // set background color, so the sky is not black this.camera.setBackgroundColor('#000000');
And you can set up the zoom like this:
this.camera.zoomTo( 2, //zoom distance 1000 // duration/speed of zoom );