Skip to content

Instantly share code, notes, and snippets.

@bitmammoth
Forked from mohapsat/parallax_bg_godot3
Created December 31, 2020 06:06
Show Gist options
  • Save bitmammoth/e5d69116af80d09de0300bdc7a1a0eb4 to your computer and use it in GitHub Desktop.
Save bitmammoth/e5d69116af80d09de0300bdc7a1a0eb4 to your computer and use it in GitHub Desktop.
ParallaxBg_Godot3
To get that ParallaxBackground working:
1. Create a ParallaxBackground node. (It doesn't need to be a child of the Camera2D node, but making it a child of the Camera2D node won't break it either)
2. Create a ParallaxLayer node as a child of the ParallaxBackground.
3. Add your sprite as a child of the ParallaxLayer node and make sure Centered is off.
4. Go back to the ParallaxLayer node.
5. Under Motion, set Mirroring to the size of your sprite (in the case of the Sky sprite, 640x640).
6. Under Motion, fiddle with the Scale setting. This is how fast that ParallaxLayer will move in relation to the camera. I found (0.1, 0.1) to be a good starting point for something like a sky.
7. Run your game, and you should have a background that infinitely loops and also has a parallax effect.
- and on smaller skies, you can set the flag: repeat, set region enabled and set up the region values for a repeating sky...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment