godot-game-loop-collection
9
总安装量
6
周安装量
#33168
全站排名
安装命令
npx skills add https://github.com/thedivergentai/gd-agentic-skills --skill godot-game-loop-collection
Agent 安装分布
opencode
6
gemini-cli
6
github-copilot
6
codex
6
kimi-cli
6
amp
6
Skill 文档
Collection Game Loops
Overview
This skill provides a standardized framework for “Collection Loops” â gameplay objectives where the player must find and gather a specific set of items (e.g., hidden eggs, data logs, coins).
Core Components
1. Collection Manager (collection_manager.gd)
The central brain of the hunt.
- Role: Tracks progress (
current / target). - Behavior: Listens for
item_collected(id)-> Updates items -> Signalscollection_completedon valid count. - Tip: Use
collection_idstrings to run multiple hunts simultaneously (e.g., “red_eggs” vs “blue_eggs”).
2. Collectible Item (collectible_item.gd)
The physical object in the world.
- Role: Handles interaction and self-destruction.
- Behavior: On Interact -> Play VFX -> Emit Signal -> Queue Free.
3. Hidden Item Spawner (hidden_item_spawner.gd)
Automates the placement of items.
- Role: Populates the level.
- Behavior: Instantiates the item scene at:
- Hand-placed
Marker3Dnodes (Deterministic). - Random points within a
CollisionShapevolume (Procedural).
- Hand-placed
Usage Example
# In a Level Script or Game Mode
@onready var manager = $CollectionManager
func _ready():
manager.start_collection("easter_egg_2024", 10)
manager.collection_completed.connect(_on_all_eggs_found)
func _on_all_eggs_found():
print("You found all the eggs! Here is a bunny hat.")
# Unlock reward
Best Practices
- Persistence: Combine with
godot-mechanic-secretsto save which specific IDs have been found if the player needs to quit and resume. - NEVER hardcode spawn positions in code: Always use
Marker3DorCollisionShape3Dnodes in the scene so designers can adjust layout without touching code. - Avoid “God Objects”: The
CollectionManagershouldn’t handle input, UI, AND audio. Let it emit signals and let other systems react. - Juice: Always spawn particles or play a sound before the item disappears. Immediate
queue_free()feels dry.