generative_agents icon indicating copy to clipboard operation
generative_agents copied to clipboard

zoom in or out map

Open Neo-Pz opened this issue 2 years ago • 3 comments

How to zoom in or zoom out on a map like Google Earth?

Neo-Pz avatar Nov 06 '23 09:11 Neo-Pz

hello 你修改下尺寸不可以么

2642543078 avatar Nov 07 '23 02:11 2642543078

You can check my commit here: https://github.com/joonspk-research/generative_agents/commit/7707c49924962ebce6bb9cf1b614328c98af0f40

ketsapiwiq avatar May 20 '24 14:05 ketsapiwiq

To reduce the zoom of the map in your simulation and display the full map, you’ll need to adjust the camera’s zoom level in your Phaser game. This can be achieved by modifying the camera settings in your create function or by adjusting the game’s scale configuration. Below, I’ll guide you through both methods and provide code snippets to help you implement the changes.

Method 1: Adjust the Camera’s Zoom Level in the create Function

The most straightforward way to change the zoom level is by setting the camera’s zoom in the create function of your Phaser scene.

Steps:

1.	Locate the Camera Setup in Your create Function:

In your code, find the section where you set up the camera: // Setting up the camera. const camera = this.cameras.main; camera.startFollow(player); camera.setBounds(0, 0, map.widthInPixels, map.heightInPixels);

  1. Add the setZoom Method: Right after setting the camera bounds, add the setZoom method to adjust the zoom level: camera.setZoom(0.5); // Adjust the zoom level as needed

• A value of 1 is the default zoom level. • Values less than 1 will zoom out (e.g., 0.5 will show more of the map). • Values greater than 1 will zoom in.

alric05 avatar Oct 06 '24 17:10 alric05