mcpField
G
godot-gdscript-patterns

godot-gdscript-patterns

github.com/wshobson開発41.9k17.7k 回インストール2 週間前に更新
リポジトリ

godot-gdscript-patterns について

Godot 4.x で GDScript を使ったゲーム開発を支援するスキルです。アーキテクチャ、シグナル、シーン、状態管理、パフォーマンスを扱い、詳細な例は別のリファレンスファイルに記載されています。

主な機能

  1. 01Godot 4.x のアーキテクチャパターン
  2. 02GDScript 開発ガイド
  3. 03シグナルとシーンの設計
  4. 04ゲーム状態の管理
  5. 05パフォーマンス最適化

活用シーン

  1. 01Godot 4 でのゲーム開発
  2. 02GDScript によるゲームシステムの実装
  3. 03再利用可能なシーン構造の設計
  4. 04GDScript のパフォーマンス改善

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/wshobson/agents --skill godot-gdscript-patterns

インストール後、Claude Code で/godot-gdscript-patternsを入力して読み込まれたか確認します。

同梱ファイルreferences/advanced-patterns.mdreferences/details.md

詳細

Godot GDScript パターン

GDScript を用いた Godot 4.x ゲーム開発のための実運用パターン集で、アーキテクチャ、シグナル、シーン、最適化を扱います。

このスキルを使用する場面

  • Godot 4 でゲームを制作する場合
  • GDScript でゲームシステムを実装する場合
  • シーンアーキテクチャを設計する場合
  • ゲームの状態を管理する場合
  • GDScript のパフォーマンスを最適化する場合
  • Godot のベストプラクティスを学ぶ場合

中核となる概念

1. Godot のアーキテクチャ
Node: Base building block
├── Scene: Reusable node tree (saved as .tscn)
├── Resource: Data container (saved as .tres)
├── Signal: Event communication
└── Group: Node categorization
2. GDScript の基本
class_name Player
extends CharacterBody2D

# Signals
signal health_changed(new_health: int)
signal died

# Exports (Inspector-editable)
@export var speed: float = 200.0
@export var max_health: int = 100
@export_range(0, 1) var damage_reduction: float = 0.0
@export_group("Combat")
@export var attack_damage: int = 10
@export var attack_cooldown: float = 0.5

# Onready (initialized when ready)
@onready var sprite: Sprite2D = $Sprite2D
@onready var animation: AnimationPlayer = $AnimationPlayer
@onready var hitbox: Area2D = $Hitbox

# Private variables (convention: underscore prefix)
var _health: int
var _can_attack: bool = true

func _ready() -> void:
    _health = max_health

func _physics_process(delta: float) -> void:
    var direction := Input.get_vector("left", "right", "up", "down")
    velocity = direction * speed
    move_and_slide()

func take_damage(amount: int) -> void:
    var actual_damage := int(amount * (1.0 - damage_reduction))
    _health = max(_health - actual_damage, 0)
    health_changed.emit(_health)

    if _health <= 0:
        died.emit()

詳細なパターンと実践例

詳細なパターンのドキュメントは references/details.md にあります。上記のナビゲーション層では不十分な場合に、そのファイルを読んでください。

コメント