[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-66ba8211-3637-4e9b-a5eb-7ee3e0163507":3,"$f4Bt4n_Mwd4eY7NM8A8Xs7NAxbGGU_USNmGwb0lkoArs":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"66ba8211-3637-4e9b-a5eb-7ee3e0163507","godot-4-migration","Godot 3.x项目迁移至Godot 4（GDScript 2.0）的专业指南，涵盖语法变化、补间动画和导出。","cat_coding_frontend","mod_coding","sickn33,coding","---\nname: godot-4-migration\ndescription: \"Specialized guide for migrating Godot 3.x projects to Godot 4 (GDScript 2.0), covering syntax changes, Tweens, and exports.\"\nrisk: safe\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# Godot 4 Migration Guide\n\n## Overview\n\nA critical guide for developers transitioning from Godot 3.x to Godot 4. This skill focuses on the major syntax changes in GDScript 2.0, the new `Tween` system, and `export` annotation updates.\n\n## When to Use This Skill\n\n- Use when porting a Godot 3 project to Godot 4.\n- Use when encountering syntax errors after upgrading.\n- Use when replacing deprecated nodes (like `Tween` node vs `create_tween`).\n- Use when updating `export` variables to `@export` annotations.\n\n## Key Changes\n\n### 1. Annotations (`@`)\n\nGodot 4 uses `@` for keywords that modify behavior.\n- `export var x` -> `@export var x`\n- `onready var y` -> `@onready var y`\n- `tool` -> `@tool` (at top of file)\n\n### 2. Setters and Getters\n\nProperties now define setters\u002Fgetters inline.\n\n**Godot 3:**\n```gdscript\nvar health setget set_health, get_health\n\nfunc set_health(value):\n    health = value\n```\n\n**Godot 4:**\n```gdscript\nvar health: int:\n    set(value):\n        health = value\n        emit_signal(\"health_changed\", health)\n    get:\n        return health\n```\n\n### 3. Tween System\n\nThe `Tween` node is deprecated. Use `create_tween()` in code.\n\n**Godot 3:**\n```gdscript\n$Tween.interpolate_property(...)\n$Tween.start()\n```\n\n**Godot 4:**\n```gdscript\nvar tween = create_tween()\ntween.tween_property($Sprite, \"position\", Vector2(100, 100), 1.0)\ntween.parallel().tween_property($Sprite, \"modulate:a\", 0.0, 1.0)\n```\n\n### 4. Signal Connections\n\nString-based connections are discouraged. Use callables.\n\n**Godot 3:**\n```gdscript\nconnect(\"pressed\", self, \"_on_pressed\")\n```\n\n**Godot 4:**\n```gdscript\npressed.connect(_on_pressed)\n```\n\n## Examples\n\n### Example 1: Typed Arrays\n\nGDScript 2.0 supports typed arrays for better performance and type safety.\n\n```gdscript\n# Godot 3\nvar enemies = []\n\n# Godot 4\nvar enemies: Array[Node] = []\n\nfunc _ready():\n    for child in get_children():\n        if child is Enemy:\n            enemies.append(child)\n```\n\n### Example 2: Awaiting Signals (Coroutines)\n\n`yield` is replaced by `await`.\n\n**Godot 3:**\n```gdscript\nyield(get_tree().create_timer(1.0), \"timeout\")\n```\n\n**Godot 4:**\n```gdscript\nawait get_tree().create_timer(1.0).timeout\n```\n\n## Best Practices\n\n- ✅ **Do:** Use `@export_range`, `@export_file`, etc., for better inspector UI.\n- ✅ **Do:** Type all variables (`var x: int`) for performance gains in GDScript 2.0.\n- ✅ **Do:** Use `super()` to call parent methods instead of `.function_name()`.\n- ❌ **Don't:** Use string names for signals (`emit_signal(\"name\")`) if you can use the signal object (`name.emit()`).\n\n## Troubleshooting\n\n**Problem:** \"Identifier 'Tween' is not a valid type.\"\n**Solution:** `Tween` is now `SceneTreeTween` or just an object returned by `create_tween()`. You rarely type it explicitly, just use `var tween = create_tween()`.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,54,1971,"2026-05-16 13:20:56",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"前端开发","frontend","mdi-language-html5","HTML\u002FCSS\u002FJavaScript\u002F框架相关",1,96,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"f00b907d-bcbb-4bf1-8b04-65be1f97d02c","1.0.0","godot-4-migration.zip",1637,"uploads\u002Fskills\u002F66ba8211-3637-4e9b-a5eb-7ee3e0163507\u002Fgodot-4-migration.zip","f9ca7c24e6f501e3adc4fcc20f25bda3c4a0aed872f48b1aec479611b3b075aa","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":3349}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]