xiaohongshu
xiaohongshu
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...
Full skill instructions
This orchestrator runs 3 position sync mini-skills in sequence. For individual operations, invoke mini-skills directly.
Iron Law: Editor preview must match runtime behavior. No surprises.
This skill automatically detects and resolves position conflicts between editor-defined positions (.tscn files) and code-defined positions (.gd files). It handles static conflicts, camera-following backgrounds, parallax layers, and player-relative positioning.
When this skill is invoked, IMMEDIATELY execute the following sequence:
# Check if this is a Godot project
ls project.godot 2>/dev/null && echo "✓ Godot project detected" || echo "✗ Not a Godot project"
If NOT a Godot project:
If IS a Godot project:
Do NOT ask "What would you like me to do?" - Start analyzing immediately.
Execute these commands in parallel:
# Detect static position conflicts
find . -name "*.gd" -exec grep -l "position\s*=" {} \; | head -20
# Find camera-following patterns
grep -rn "position\s*=.*camera\|position\s*=.*player" --include="*.gd" . | head -20
# Find parallax backgrounds
find . -name "*parallax*.tscn" -o -name "*background*.tscn" | head -10
# Count potential conflicts
find . -name "*.gd" -exec grep -c "^\s*position\s*=" {} + | awk '{s+=$1} END {print s}'
Show the user:
=== Editor Position Sync Analysis ===
Project: [project name from project.godot]
Conflicts detected:
- Static position assignments: X
- Camera-following elements: X
- Parallax backgrounds: X
- Player-relative positioning: X
Total: X position conflicts found
Sync includes:
✓ Detect editor vs code position conflicts
✓ Smart classification (intentional vs conflict)
✓ Camera-aware positioning
✓ Multiple sync strategies
✓ Git commit per operation
✓ Auto-rollback on test failure
Would you like me to:
1. Proceed with automatic sync (recommended)
2. Show detailed breakdown first
3. Cancel
CRITICAL: Do NOT stop after loading the skill. Do NOT ask "What would you like me to do?" Start with step 1 immediately.
Use this skill when you detect ANY of these symptoms:
Static Position Conflicts:
position = Vector2(x, y) in _ready() or _init()Camera-Following Elements:
position = camera.position patternsPlayer-Relative Positioning:
position = player.position + offset patternsEditor Preview Mismatch:
User mentions position issues
↓
Is it editor vs runtime mismatch?
↓ YES ↓ NO
Use this skill Different issue
↓
Run Phase 1: Detection
↓
Conflicts found?
↓ YES ↓ NO
Run Phases 2-3 Document clean state
Purpose: Detect position conflicts and classify them intelligently.
Steps:
# Find all Godot script files
find . -name "*.gd" -type f
# Find all scene files
find . -name "*.tscn" -type f
Scan for position-setting patterns:
# Static position assignments
grep -rn "position\s*=\s*Vector2(" --include="*.gd" .
# Camera-following patterns
grep -rn "position\s*=.*camera" --include="*.gd" .
# Player-following patterns
grep -rn "position\s*=.*player" --include="*.gd" .
# Parallax patterns
grep -rn "ParallaxBackground\|ParallaxLayer" --include="*.gd" .
Extract position properties from scenes:
# Find position declarations in .tscn files
grep -rn "^position\s*=\s*Vector2(" --include="*.tscn" .
For each detected position assignment, classify as:
_ready() differs from .tscn_process() (critical warning)Classification Logic:
def classify_position_assignment(context):
# Context = 30 lines around assignment
# SKIP: Animation/tween
if "tween" in context or "create_tween" in context:
return "INTENTIONAL_ANIMATION"
# SKIP: Camera following
if "camera.position" in context or "get_viewport().get_camera" in context:
return "INTENTIONAL_DYNAMIC"
# SKIP: Player following
if "player.position" in context or "target.position" in context:
return "INTENTIONAL_DYNAMIC"
# CRITICAL: Every frame assignment
if "_process(" in context:
return "PROCESS_ASSIGNMENT"
# CONFLICT: Static assignment in _ready
if "_ready(" in context and "Vector2(" in line:
return "CONFLICT"
return "UNKNOWN"
Generate a priority-ordered list:
| File | Node | Editor Position | Code Position | Classification | Sync Strategy |
|---|---|---|---|---|---|
| background.gd | Background | (0, 0) | camera.position | DYNAMIC | Document intent |
| enemy.gd | Enemy | (500, 300) | (100, 150) | CONFLICT | Code → Editor |
| ui_label.gd | Label | (10, 10) | (50, 50) | CONFLICT | Editor → Code |
Phase 1 Output:
Process conflicts in priority order: Critical → Conflicts → Dynamic
CRITICAL - After Each Operation:
Automatic Testing Procedure:
# Quick validation test (runs after each git commit)
echo "Running validation test..."
godot --headless --quit-after 5 project.godot 2>&1 | tee test_output.log
# Check for errors
if grep -q "ERROR\|SCRIPT ERROR\|Parse Error" test_output.log; then
echo "⚠️ Tests failed - reverting operation"
git reset --hard HEAD~1
echo "❌ Operation reverted. Error details:"
grep "ERROR\|SCRIPT ERROR\|Parse Error" test_output.log
# STOP and report to user
else
echo "✓ Tests passed - continuing"
rm test_output.log
# CONTINUE to next operation automatically
fi
Target: Static position conflicts where code position should be editor position
When to use:
_ready() and never changesProcess:
# Example: enemy.gd sets position in _ready()
grep -A5 "_ready" enemy.gd
Example code:
# enemy.gd
func _ready():
position = Vector2(100, 150) # Conflict with .tscn
Example .tscn:
[node name="Enemy" type="CharacterBody2D"]
position = Vector2(500, 300) # Different from code
Parse and update:
# Read .tscn file
with open("enemy.tscn") as f:
content = f.read()
# Find and replace position line
content = re.sub(
r'position = Vector2\([^)]+\)',
'position = Vector2(100, 150)',
content
)
# Write back
with open("enemy.tscn", "w") as f:
f.write(content)
Remove static assignment, add comment:
# enemy.gd
func _ready():
# Position moved to .tscn for editor visibility
# Was: position = Vector2(100, 150)
pass
git add enemy.tscn enemy.gd
git commit -m "Sync: Move enemy position from code to editor (.tscn)
- Updated enemy.tscn position to Vector2(100, 150)
- Removed static position assignment from enemy.gd
- Editor now matches runtime position"
Success criteria:
Target: Position should be set in code, remove .tscn position
When to use:
Process:
Code already correct:
func _ready():
position = Vector2(100, 150) # Correct position
Update .tscn to neutral position:
[node name="Enemy" type="CharacterBody2D"]
# position removed (defaults to Vector2(0, 0))
Or explicitly set to origin:
position = Vector2(0, 0)
Add comment explaining:
func _ready():
# Position set in code (not in .tscn)
# Editor shows (0,0), runtime shows calculated position
position = Vector2(100, 150)
git commit -m "Sync: Keep enemy position in code, reset editor
- Removed position from enemy.tscn (defaults to origin)
- Kept code position assignment
- Runtime position calculated in _ready()"
Target: Backgrounds, parallax layers, camera-following elements
When to use:
Special Case - User's Background Issue:
Problem: Background positioned at (0, 0) in editor, but follows camera at runtime, causing confusion during level design.
Solution:
# background.gd
func _process(delta):
position = camera.position # Follows camera
Find typical camera start position:
# Search for camera or player spawn position
grep -rn "camera.*position\|player.*position" --include="*.tscn" .
Example: Camera starts at (512, 300)
[node name="Background" type="Sprite2D"]
position = Vector2(512, 300) # Camera start position
# background.gd
func _process(delta):
# EDITOR NOTE: Position in .tscn shows camera start position
# for accurate level design preview. At runtime, follows camera.
position = camera.position
Generate editor plugin to show camera bounds:
# addons/camera_preview/camera_preview.gd
@tool
extends EditorPlugin
func _enter_tree():
# Draw camera bounds in editor
pass
Result:
git commit -m "Sync: Camera-aware background positioning
- Updated background.tscn to camera start position
- Added documentation for camera-following behavior
- Editor now shows accurate runtime preview"
Success criteria:
Purpose: Ensure synchronization succeeded without regressions.
Steps:
godot --editor project.godot
# Run main scene for 10 seconds
godot --quit-after 10 project.godot
# Re-run detection to verify all conflicts resolved
grep -rn "position\s*=\s*Vector2(" --include="*.gd" . | wc -l
=== Position Sync Complete ===
Conflicts resolved: X
- Code → Editor: X
- Editor → Code: X
- Camera-aware: X
Files modified:
- X .tscn files updated
- X .gd files updated
Git commits created: X
All tests passing ✓
No regressions detected ✓
Editor preview matches runtime ✓
This skill uses modular reference files:
Read these files for detailed implementation guidance.
These thoughts mean you're rationalizing away discipline:
| Rationalization | Reality | Fix |
|---|---|---|
| "This dynamic position is a conflict" | Misclassification breaks behavior | Use intelligent classifier |
| "I'll sync all positions" | Over-sync breaks intentional dynamic positioning | Only sync true conflicts |
| "Camera-following is a conflict" | Wrong - it's intentional | Skip dynamic patterns |
| "I don't need to test this change" | Untested = broken | Always verify |
| "Close enough in editor" | Iron Law has no exceptions | Exact positions only |
| "I'll manually fix .tscn" | Manual edits create errors | Parse programmatically |
| Conflict Type | Detection | Strategy |
|---|---|---|
| Static in _ready() | position = Vector2() in _ready | Code → Editor |
| Calculated position | position = calc_spawn() | Editor → Code |
| Camera-following | position = camera.position | Camera-aware |
| Parallax layer | ParallaxLayer + scroll | Camera-aware |
| Player-relative | position = player.position + offset | Document dynamic |
| Animation/tween | tween_property("position") | SKIP (intentional) |
| Every frame (_process) | position in _process | CRITICAL warning |
Problem Statement:
position = camera.positionSolution:
# Find main camera or player spawn point
grep -rn "Camera2D\|player.*position" --include="*.tscn" .
# Parse camera start position from main scene
camera_start = Vector2(512, 300) # Example
# Set background .tscn to camera start
background_position = camera_start
[node name="Background" type="Sprite2D"]
position = Vector2(512, 300) # Camera start (was 0, 0)
# background.gd
# EDITOR PREVIEW: Position set to camera start for accurate level design
# RUNTIME: Follows camera dynamically
func _process(delta):
position = camera.position
For ParallaxBackground nodes:
# parallax_background.gd
@export var camera_start_position := Vector2(512, 300)
func _ready():
# Set initial scroll to camera start
scroll_offset = camera_start_position
Result:
This skill runs fully automatically:
User input required:
Everything else is automatic:
Synchronization is complete when:
Works well with:
Best practice workflow:
Remember: Editor preview is your source of truth for visual design. Runtime must match what you see in the editor. No surprises.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience