Ashish Posted February 9, 2018 Share Posted February 9, 2018 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? Link to comment Share on other sites More sharing options...
Kosmoon Posted February 11, 2018 Share Posted February 11, 2018 maybe playing with game.camera.bounds.x / game.camera.bounds.y and game.camera.scale.x / game.camera.scale.y will do the job. Link to comment Share on other sites More sharing options...
samme Posted February 11, 2018 Share Posted February 11, 2018 (edited) I think you have to use both tileOffset and setScale. Edited February 15, 2018 by samme tileOffset. others are read-only Link to comment Share on other sites More sharing options...
Ashish Posted February 14, 2018 Author Share Posted February 14, 2018 Hey @samme , can you explain how I will use it? Link to comment Share on other sites More sharing options...
mickeyren Posted February 15, 2018 Share Posted February 15, 2018 you can also put your stuff in a group - and you scale that group. so you create a group by doing `game.add.group()` then you put your sprites in it. then that group you set it's scale, your sprites will mass zoom in and out. Note that you can do this in the game.world too. but what's nice about having each group is that for example yo have a texts or a minimap and you don't want those included in the zooming process. Link to comment Share on other sites More sharing options...
Ashish Posted February 15, 2018 Author Share Posted February 15, 2018 Thank you @mickeyren, I am using tilemap, so loading json file and image . How can I consider that as Sprite. Link to comment Share on other sites More sharing options...
samme Posted February 15, 2018 Share Posted February 15, 2018 Link to comment Share on other sites More sharing options...
Ashish Posted February 15, 2018 Author Share Posted February 15, 2018 Thank you man @samme, This will help me for sure. Link to comment Share on other sites More sharing options...
Ashish Posted February 16, 2018 Author Share Posted February 16, 2018 Hey @samme I saw the example you have given. I have some problem with that How can I increase and decrease the scale using mouse click or some like that. I don't want to use new Gui. Link to comment Share on other sites More sharing options...
Ashish Posted February 17, 2018 Author Share Posted February 17, 2018 And one more thing @samme, In your example map is loading according to pixel size and that only we can zoom in and out. But I want to load the full map in same 800*600 or less (600*400) area.How can I implement this? Link to comment Share on other sites More sharing options...
Recommended Posts