# ParallaxX

### Introduction

MapDrawableBatches (map layers) support parallax by assigning the values in Tiled or in code. By default parallax has a value of 1, which means that the object will show no parallax. A value between 0 and 1 results in the layer behaving as if it is in the distance (not scrolling as quickly when the camera moves). A value greater than 1 results in the layer behaving as if it is in the foreground (scrolling more quickly when the camera moves).

### Example - Setting Parallax Factor in Tiled

To set parallax:

1. Open an existing map
2. Select a layer
3. Change its Parallax Factor property to the desired value

   ![](https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-9c106ce97fd515648c41e3e71988d98756350f7a%2F2022-08-img_630bb51ae5135.png?alt=media)
4. Tiled provides a preview of the parallax if you scroll the main view

<figure><img src="https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-97b0e7fdc673675101bf0eded3a164bb478a380c%2F2022-08-28_12-34-43.gif?alt=media" alt=""><figcaption></figcaption></figure>

Once the file is saved, the parallax will automatically be applied at runtime in the game.

<figure><img src="https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-0ef9248342c9d120a8df1350f4eab5476f3f78df%2F2022-08-28_12-36-06.gif?alt=media" alt=""><figcaption></figcaption></figure>
