Skip to content
godot-sync-parallax logo

Sync Parallax Layer Positions

godot-sync-parallax

Use when Godot ParallaxBackground/ParallaxLayer nodes show incorrect positions in editor due to parallax multipliers. Calculates correct editor positions based on camera start position and parallax motion scale. Makes parallax layers preview realistically in editor, matching gameplay appearance.

Asreonn/godot-superpowers0installs4stars

SKILL.md

Full skill instructions

Sync Parallax Layer Positions

Core Principle

Parallax layers need special math for correct editor preview. Motion scale affects runtime position.

What This Skill Does

Parallax systems in Godot are complex:

# Godot's parallax formula:
final_position = layer_position - (camera_position * motion_scale)

The problem:

  • Editor shows layer at layer_position
  • Runtime shows layer at layer_position - (camera_position * motion_scale)
  • Editor preview doesn't match gameplay

The solution: Calculate correct layer_position so runtime appearance matches intended design.

Example Problem

# parallax_background.tscn
[node name="ParallaxBackground" type="ParallaxBackground"]

[node name="SkyLayer" type="ParallaxLayer" parent="."]
motion_scale = Vector2(0.2, 0.2)  # Slow parallax
position = Vector2(0, 0)

# Camera starts at (640, 360)
# Runtime position: 0 - (640 * 0.2) = -128 (WRONG!)
# Sky layer appears shifted left in game

After sync:

[node name="SkyLayer" type="ParallaxLayer" parent="."]
motion_scale = Vector2(0.2, 0.2)
position = Vector2(128, 72)  # Corrected!

# Runtime position: 128 - (640 * 0.2) = 0 (CORRECT!)
# Sky layer appears centered in game, matching editor

Detection Patterns

Identifies parallax systems:

ParallaxBackground Structure

[node name="ParallaxBackground" type="ParallaxBackground"]
scroll_offset = Vector2(0, 0)
scroll_base_scale = Vector2(1, 1)

[node name="Layer1" type="ParallaxLayer" parent="."]
motion_scale = Vector2(0.5, 0.5)
motion_offset = Vector2(0, 0)

Multiple Layers with Different Scales

[node name="SkyLayer" parent="ParallaxBackground"]
motion_scale = Vector2(0.1, 0.1)  # Very slow (far away)

[node name="MountainsLayer" parent="ParallaxBackground"]
motion_scale = Vector2(0.3, 0.3)  # Slow (middle distance)

[node name="TreesLayer" parent="ParallaxBackground"]
motion_scale = Vector2(0.7, 0.7)  # Fast (close)

When to Use

Designing Parallax Backgrounds

Creating multi-layer parallax effect in editor.

Debugging Parallax Issues

Layers appear at wrong positions in game.

Visual Level Design

Want WYSIWYG for parallax systems.

Multiple Parallax Layers

Complex parallax with many layers at different scales.

Process

  1. Scan - Find ParallaxBackground and ParallaxLayer nodes
  2. Detect Camera - Find camera start position
  3. Calculate - Apply inverse parallax formula
  4. Update Positions - Correct layer positions in .tscn
  5. Update Offsets - Adjust motion_offset if needed
  6. Validate - Ensure layers align correctly
  7. Commit - Git commit per parallax system

Parallax Math

Forward Formula (Godot's runtime calculation)

displayed_position = layer_position - (camera_position * motion_scale)

Inverse Formula (What we need for editor)

layer_position = desired_position + (camera_position * motion_scale)

Example Calculation

Want sky layer centered at (0, 0) in game:

  • Camera starts at: (640, 360)
  • Motion scale: (0.2, 0.2)
  • Calculate: layer_position = 0 + (640 * 0.2) = 128
  • Calculate: layer_position = 0 + (360 * 0.2) = 72
  • Set layer position in editor: (128, 72)

Example Transformations

Example 1: Sky Layer

Before (Broken):

[node name="SkyLayer" type="ParallaxLayer"]
motion_scale = Vector2(0.2, 0.2)
position = Vector2(0, 0)
# Sprite at (0, 0) relative to layer

# Camera at (640, 360)
# Runtime: 0 - (640 * 0.2) = -128
# Sky appears -128 pixels left (WRONG)

After (Fixed):

[node name="SkyLayer" type="ParallaxLayer"]
motion_scale = Vector2(0.2, 0.2)
position = Vector2(128, 72)  # Corrected
# Sprite at (0, 0) relative to layer

# Runtime: 128 - (640 * 0.2) = 0
# Sky appears centered (CORRECT)

Example 2: Multiple Layers

Before (All at origin):

[node name="Sky" type="ParallaxLayer"]
motion_scale = Vector2(0.1, 0.1)
position = Vector2(0, 0)

[node name="Mountains" type="ParallaxLayer"]
motion_scale = Vector2(0.3, 0.3)
position = Vector2(0, 0)

[node name="Trees" type="ParallaxLayer"]
motion_scale = Vector2(0.7, 0.7)
position = Vector2(0, 0)

# All layers shifted left at runtime

After (Corrected):

[node name="Sky" type="ParallaxLayer"]
motion_scale = Vector2(0.1, 0.1)
position = Vector2(64, 36)  # 640*0.1, 360*0.1

[node name="Mountains" type="ParallaxLayer"]
motion_scale = Vector2(0.3, 0.3)
position = Vector2(192, 108)  # 640*0.3, 360*0.3

[node name="Trees" type="ParallaxLayer"]
motion_scale = Vector2(0.7, 0.7)
position = Vector2(448, 252)  # 640*0.7, 360*0.7

# All layers centered correctly at runtime

Advanced: Motion Offset

Motion Offset vs Position

  • position: Layer's base position
  • motion_offset: Additional offset applied with motion_scale

Combined formula:

displayed_position = (layer_position + motion_offset) - (camera_position * motion_scale)

Syncing considers both properties.

Smart Detection

Identifies parallax systems:

  • ParallaxBackground node present
  • ParallaxLayer children with motion_scale ≠ (1, 1)
  • Sprite/​TextureRect children of layers

Detects camera:

  1. Camera2D in scene hierarchy
  2. Camera position from parent scene
  3. Viewport center (default: 640, 360 for 1280x720)

Calculates corrections:

  • Per-layer based on motion_scale
  • Accounts for motion_offset
  • Handles ParallaxBackground scroll_offset

What Gets Created

  • Updated .tscn files with corrected layer positions
  • Comments documenting parallax calculations
  • Validation ensuring layers align correctly
  • Git commits per parallax system

Integration

Works with:

  • godot-sync-camera-positions - Non-parallax camera following
  • godot-sync-static-positions - Static position conflicts
  • godot-fix-positions (orchestrator) - All position sync operations

Safety

  • Parallax behavior unchanged at runtime
  • Only editor positions updated
  • Original .tscn preserved in git
  • Validation ensures layers align
  • Rollback on validation failure

When NOT to Use

Don't sync if:

  • Parallax positions intentionally offset
  • Custom parallax implementation (not ParallaxBackground)
  • Dynamic parallax scaling at runtime
  • Camera position highly variable

Benefits

  • Visual Design - Design parallax layers in editor
  • WYSIWYG - Preview matches gameplay
  • Debugging - Obvious when layers misaligned
  • Faster Iteration - See results immediately
  • Team Friendly - Level designers work in editor

Common Parallax Patterns

Infinite Scrolling Background

[node name="CloudsLayer" type="ParallaxLayer"]
motion_scale = Vector2(0.2, 0)  # Horizontal only
motion_mirroring = Vector2(1280, 0)  # Repeat horizontally

Sync: Correct horizontal position only.

Vertical Parallax (Platformer)

[node name="SkyLayer" type="ParallaxLayer"]
motion_scale = Vector2(0, 0.1)  # Vertical only

Sync: Correct vertical position only.

Full 2D Parallax

[node name="BackgroundLayer" type="ParallaxLayer"]
motion_scale = Vector2(0.3, 0.3)  # Both axes

Sync: Correct both x and y positions.

Validation

After syncing, validates:

  • All layers visible in editor
  • Layer order preserved (back to front)
  • Sprites aligned as intended
  • No layer at negative positions (unless intentional)
  • Editor preview looks realistic

Camera Position Detection

Priority Order

  1. Camera2D in current scene → use position
  2. Camera2D in parent scene → use position
  3. Viewport size → assume center (width/​2, height/​2)
  4. Project settings → get viewport size
  5. Ask user if uncertain

Documentation Pattern

# Parallax layer corrected for camera start: (640, 360)
# motion_scale: (0.2, 0.2)
# Formula: position = desired_runtime_position + (camera * motion_scale)
# Calculation: (0, 0) + (640 * 0.2, 360 * 0.2) = (128, 72)

Clear documentation shows calculation method.

Common Issues Fixed

IssueCauseSolution
Layer shifted left in gameposition = (0,0), motion_scale < 1Add offset: camera * motion_scale
Layer jumps at startEditor position ≠ runtime positionSync positions using formula
Layers misalignedDifferent camera assumptionsConsistent camera start position
Preview doesn't match gameParallax math not consideredApply inverse parallax formula

Performance Considerations

Parallax systems are efficient but:

  • Limit number of layers (typically 3-5)
  • Use TextureRect for static backgrounds
  • Consider motion_mirroring for infinite scrolling
  • Avoid heavy shaders on parallax layers

Syncing positions doesn't affect performance, only editor usability.

More skills from Asreonn

godot-sync-camera-positions logo
Asreonn/godot-superpowers

godot-sync-camera-positions

Use when Godot background layers or elements follow the camera at runtime but show incorrect position in editor. Detects camera-following patterns and syncs editor position to match typical runtime state. Makes editor preview accurately show what players will see during gameplay.

4 0
View
godot-refactor logo
Asreonn/godot-superpowers

godot-refactor

Use when Godot project has code-created objects, tight coupling via direct references, monolithic scripts over 150 lines, or needs scene-first architecture with signals and composition. Orchestrates all 5 code quality mini-skills: extract-to-scenes, split-scripts, add-signals, extract-resources, ...

4 0
View
godot-split-scripts logo
Asreonn/godot-superpowers

godot-split-scripts

Use when Godot scripts exceed 150 lines or have multiple responsibilities. Detects scripts doing too many things (player movement + combat + inventory + UI). Automatically splits into focused scripts following Single Responsibility Principle, preserves behavior exactly, and creates git commits pe...

4 0
View
godot-convert-shaders logo
Asreonn/godot-superpowers

godot-convert-shaders

Converts Godot 3.x shader code to Godot 4.x shader syntax. Updates SCREEN_TEXTURE to screen_texture uniform, DEPTH_TEXTURE to depth_texture uniform, texture() function changes, built-in varyings updates, and light function signature changes. Essential for rendering and visual effect migrations.

4 0
View
godot-migrate-tilemap logo
Asreonn/godot-superpowers

godot-migrate-tilemap

Migrates legacy TileMap (Godot 4.0-4.2) to new TileMapLayer system (Godot 4.3+). Handles TileMap node conversion, API migration (set_cell to set_cells_terrain_connect), TileSet resource updates, physics layer mapping, navigation layer conversion, and custom data preservation. Essential for upgrad...

4 0
View
godot-setup-animationtree logo
Asreonn/godot-superpowers

godot-setup-animationtree

Use when setting up AnimationTree nodes for state machine-driven animation, creating AnimationNodeStateMachine graphs, configuring BlendSpace2D/3D for locomotion blending, implementing state transition conditions, or creating animation blend trees for complex animation mixing. Supports player cha...

4 0
View
godot-extract-resources logo
Asreonn/godot-superpowers

godot-extract-resources

Use when Godot code has hardcoded game data in const arrays, dictionaries, or embedded values. Detects inline data like enemy stats, item definitions, level configurations. Automatically extracts to .tres resource files, making data visible in editor, easily modifiable, and supports data-driven d...

4 0
View
godot-modernize-input logo
Asreonn/godot-superpowers

godot-modernize-input

Use when handling input in Godot 4.x projects and need to modernize patterns. Generates Input Map configurations from hardcoded key checks, sets up joypad rumble (Godot 4.x feature), implements gyroscope/accelerometer input on mobile, creates context-sensitive input handling for different game st...

4 0
View
godot-setup-export logo
Asreonn/godot-superpowers

godot-setup-export

Use when setting up multi-platform exports for Godot projects, configuring export presets, icons, feature tags, build scripts, or CI/CD pipelines

4 0
View
godot-generate-tests logo
Asreonn/godot-superpowers

godot-generate-tests

Use when developing Godot games and need comprehensive test coverage for GDScript classes, signals, scene initialization, and integration flows. Generates GUT framework unit tests, integration tests, mock/stub helpers, and CI/CD test runner configuration.

4 0
View
godot-fix-positions logo
Asreonn/godot-superpowers

godot-fix-positions

Use when Godot project has position conflicts between editor (.tscn) and code (.gd), camera-following backgrounds, or runtime positions don't match editor preview. Orchestrates all 3 position sync mini-skills: sync-static-positions, sync-camera-positions, and sync-parallax. Each operation targets...

4 0
View
godot-organize-assets logo
Asreonn/godot-superpowers

godot-organize-assets

Use when Godot project has disorganized assets (sprites, audio, fonts, materials). Detects scattered asset files and organizes them into clear categories with consistent naming. Creates sprite atlases where beneficial, organizes audio by type, and groups related assets together.

4 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View