skills/godot-combat-system/SKILL.md
Expert patterns for combat systems including hitbox/hurtbox architecture, damage calculation (DamageData class), health components, combat state machines, combo systems, ability cooldowns, and damage popups. Use for action games, RPGs, or fighting games. Trigger keywords: Hitbox, Hurtbox, DamageData, HealthComponent, combat_state, combo_system, ability_cooldown, invincibility_frames, damage_popup.
npx skillsauth add thedivergentai/gd-agentic-skills godot-combat-systemInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert guidance for building flexible, component-based combat systems.
target.health -= 10) — This bypasses armor, resistances, and invincibility logic. Always use a DamageData + HealthComponent pattern for consistent results.AnimationPlayer tracks or code-timed triggers.has_method(&"take_damage") or the is operator for safe type checking.create_tween() or Engine.time_scale for visual hit-stop effects._physics_process() or _integrate_forces() to remain deterministic and stable.health_changed signal. This keeps your combat logic clean and independent of UI implementation details.set_deferred("disabled", true).CircleShape2D.radius) instead.Resource class for lightweight, efficient, and inspectable stat containers.enum flags (optionally with @export_flags) to manage multi-type damage efficiently.StringName (&"attacking", &"stunned") to drastically improve dictionary lookups and hash comparison speeds.duplicate() when instancing a mob, all enemies of that type will share the same health pool.MANDATORY: Read the appropriate script before implementing the corresponding pattern.
10 Expert patterns: Safe duck-typing, hitstun tweens, nodeless AoE shape casting, and frame-perfect sync.
Component-based hitbox with hit-stop and knockback logic.
# damage_data.gd
class_name DamageData
extends RefCounted
var amount: float
var source: Node
var damage_type: String = "physical"
var knockback: Vector2 = Vector2.ZERO
var is_critical: bool = false
func _init(dmg: float, src: Node = null) -> void:
amount = dmg
source = src
# hurtbox.gd
extends Area2D
class_name Hurtbox
signal damage_received(data: DamageData)
@export var health_component: Node
func _ready() -> void:
area_entered.connect(_on_area_entered)
func _on_area_entered(area: Area2D) -> void:
if area is Hitbox:
var damage := area.get_damage()
damage_received.emit(damage)
if health_component:
health_component.take_damage(damage)
# hitbox.gd
extends Area2D
class_name Hitbox
@export var damage: float = 10.0
@export var damage_type: String = "physical"
@export var knockback_force: float = 100.0
@export var owner_node: Node
func get_damage() -> DamageData:
var data := DamageData.new(damage, owner_node)
data.damage_type = damage_type
# Calculate knockback direction
if owner_node:
var direction := (global_position - owner_node.global_position).normalized()
data.knockback = direction * knockback_force
return data
# health_component.gd
extends Node
class_name HealthComponent
signal health_changed(old_health: float, new_health: float)
signal died
signal healed(amount: float)
@export var max_health: float = 100.0
@export var current_health: float = 100.0
@export var invincible: bool = false
func take_damage(data: DamageData) -> void:
if invincible:
return
var old_health := current_health
current_health -= data.amount
current_health = clampf(current_health, 0, max_health)
health_changed.emit(old_health, current_health)
if current_health <= 0:
died.emit()
func heal(amount: float) -> void:
var old_health := current_health
current_health += amount
current_health = minf(current_health, max_health)
healed.emit(amount)
health_changed.emit(old_health, current_health)
func is_dead() -> bool:
return current_health <= 0
# combat_state.gd
extends Node
class_name CombatState
enum State { IDLE, ATTACKING, BLOCKING, DODGING, STUNNED }
var current_state: State = State.IDLE
var can_act: bool = true
func enter_attack_state() -> bool:
if not can_act:
return false
current_state = State.ATTACKING
can_act = false
return true
func enter_block_state() -> void:
current_state = State.BLOCKING
func enter_dodge_state() -> bool:
if not can_act:
return false
current_state = State.DODGING
can_act = false
return true
func exit_state() -> void:
current_state = State.IDLE
can_act = true
# combo_system.gd
extends Node
class_name ComboSystem
signal combo_executed(combo_name: String)
@export var combo_window: float = 0.5
var combo_buffer: Array[String] = []
var last_input_time: float = 0.0
func register_input(action: String) -> void:
var current_time := Time.get_ticks_msec() / 1000.0
if current_time - last_input_time > combo_window:
combo_buffer.clear()
combo_buffer.append(action)
last_input_time = current_time
check_combos()
func check_combos() -> void:
# Light → Light → Heavy = Special Attack
if combo_buffer.size() >= 3:
var last_three := combo_buffer.slice(-3)
if last_three == ["light", "light", "heavy"]:
execute_combo("special_attack")
combo_buffer.clear()
func execute_combo(combo_name: String) -> void:
combo_executed.emit(combo_name)
# ability.gd
class_name Ability
extends Resource
@export var ability_name: String
@export var cooldown: float = 1.0
@export var damage: float = 25.0
@export var range: float = 100.0
@export var animation: String
var is_on_cooldown: bool = false
func can_use() -> bool:
return not is_on_cooldown
func use(caster: Node) -> void:
if not can_use():
return
is_on_cooldown = true
# Execute ability logic
_execute(caster)
# Start cooldown
await caster.get_tree().create_timer(cooldown).timeout
is_on_cooldown = false
func _execute(caster: Node) -> void:
# Override in derived abilities
pass
# damage_popup.gd
extends Label
func show_damage(amount: float, is_crit: bool = false) -> void:
text = str(int(amount))
if is_crit:
modulate = Color.RED
scale = Vector2(1.5, 1.5)
var tween := create_tween()
tween.set_parallel(true)
tween.tween_property(self, "position:y", position.y - 50, 1.0)
tween.tween_property(self, "modulate:a", 0.0, 1.0)
tween.finished.connect(queue_free)
func calculate_damage(base_damage: float, crit_chance: float = 0.1) -> DamageData:
var data := DamageData.new(base_damage)
if randf() < crit_chance:
data.is_critical = true
data.amount *= 2.0
return data
godot-2d-physics, godot-animation-player, godot-characterbody-2ddevelopment
Godot Expert Auditor: Aurelius. Exhaustive never-list enforcement and architectural slap-down for Godot 4.6 projects.
development
--- name:# Godot Expert Analyst: Anara ## Visionary Architect of Godot 4.6+ Excellence > "Scale is not a feature; it is a philosophy. I don't look at what your game is today; I look at whether it can survive tomorrow." — Anara You are **Anara**, the visionary architect of Godot 4.6+ excellence. You evaluate projects not for "if they work", but for "how well they scale". Your purpose is to certify professional-grade projects and provide the blueprint for architectural transcendence. Your voice
development
Expert blueprint for AI pathfinding (tower defense, RTS, stealth) using NavigationAgent2D/3D, NavigationServer, avoidance, and dynamic navigation mesh generation. Use when implementing enemy AI, NPC movement, or obstacle avoidance. Keywords NavigationAgent2D, NavigationRegion2D, pathfinding, NavigationServer, avoidance, baking, NavigationObstacle.
development
Expert patterns for Godot audio including AudioStreamPlayer variants (2D positional, 3D spatial), AudioBus mixing architecture, dynamic effects (reverb, EQ,compression), audio pooling for performance, music transitions (crossfade, bpm-sync), and procedural audio generation. Use for music systems, sound effects, spatial audio, or audio-reactive gameplay. Trigger keywords: AudioStreamPlayer, AudioStreamPlayer2D, AudioStreamPlayer3D, AudioBus, AudioServer, AudioEffect, music_crossfade, audio_pool, positional_audio, reverb, bus_volume.