2D Map and Scene Generator
0x0funky/agent-sprite-forge
Plans and builds 2D game maps and scenes, from tilemaps and parallax backgrounds to HD-2D plates, with collision checks, a playable HTML preview and Tiled, Godot or LDtk export.
Godot 4武器切换系统,支持武器类型枚举、武器基类设计、多种切换逻辑、输入绑定和锁定机制. An agent skill from 925236118/AlphaAgent.
$ npx skills add 925236118/AlphaAgent --skill godot-weapon-system -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install 925236118/AlphaAgent godot-weapon-system --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/925236118/AlphaAgent.git skills-src && mkdir -p .claude/skills && cp -r skills-src/addons/agent/skills/default_skills/godot-weapon-system .claude/skills/godot-weapon-system && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "godot-weapon-system" agent skill from https://github.com/925236118/AlphaAgent/tree/master/addons/agent/skills/default_skills/godot-weapon-system into .claude/skills/godot-weapon-system/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "godot-weapon-system", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/925236118/AlphaAgent/tree/master/addons/agent/skills/default_skills/godot-weapon-systemType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add 925236118/AlphaAgent --skill godot-weapon-system -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install 925236118/AlphaAgent godot-weapon-system --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/925236118/AlphaAgent.git skills-src && mkdir -p .agents/skills && cp -r skills-src/addons/agent/skills/default_skills/godot-weapon-system .agents/skills/godot-weapon-system && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "godot-weapon-system" agent skill from https://github.com/925236118/AlphaAgent/tree/master/addons/agent/skills/default_skills/godot-weapon-system into .agents/skills/godot-weapon-system/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "godot-weapon-system", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add 925236118/AlphaAgent --skill godot-weapon-system -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install 925236118/AlphaAgent godot-weapon-system --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/925236118/AlphaAgent.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/addons/agent/skills/default_skills/godot-weapon-system .cursor/skills/godot-weapon-system && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "godot-weapon-system" agent skill from https://github.com/925236118/AlphaAgent/tree/master/addons/agent/skills/default_skills/godot-weapon-system into .cursor/skills/godot-weapon-system/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "godot-weapon-system", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/925236118/AlphaAgent.git --path addons/agent/skills/default_skills/godot-weapon-system--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add 925236118/AlphaAgent --skill godot-weapon-system -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install 925236118/AlphaAgent godot-weapon-system --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/925236118/AlphaAgent.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/addons/agent/skills/default_skills/godot-weapon-system .gemini/skills/godot-weapon-system && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "godot-weapon-system" agent skill from https://github.com/925236118/AlphaAgent/tree/master/addons/agent/skills/default_skills/godot-weapon-system into .gemini/skills/godot-weapon-system/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "godot-weapon-system", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install 925236118/AlphaAgent godot-weapon-systemInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add 925236118/AlphaAgent --skill godot-weapon-system -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/925236118/AlphaAgent.git skills-src && mkdir -p .github/skills && cp -r skills-src/addons/agent/skills/default_skills/godot-weapon-system .github/skills/godot-weapon-system && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "godot-weapon-system" agent skill from https://github.com/925236118/AlphaAgent/tree/master/addons/agent/skills/default_skills/godot-weapon-system into .github/skills/godot-weapon-system/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "godot-weapon-system", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add 925236118/AlphaAgent --skill godot-weapon-system -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install 925236118/AlphaAgent godot-weapon-system --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/925236118/AlphaAgent.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/addons/agent/skills/default_skills/godot-weapon-system .opencode/skills/godot-weapon-system && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "godot-weapon-system" agent skill from https://github.com/925236118/AlphaAgent/tree/master/addons/agent/skills/default_skills/godot-weapon-system into .opencode/skills/godot-weapon-system/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "godot-weapon-system", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
godot-weapon-systemGodot 4武器切换系统,支持武器类型枚举、武器基类设计、多种切换逻辑、输入绑定和锁定机制. An agent skill from 925236118/AlphaAgent.
Godot Weapon System is an agent skill from 925236118/AlphaAgent. Godot 4武器切换系统,支持武器类型枚举、武器基类设计、多种切换逻辑、输入绑定和锁定机制。
Its SKILL.md is about 5.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Game Development, covering Game development. It works with Godot. The repository describes itself as: 为Godot引擎编辑器开发的Ai Agent插件. The licence is MIT.
6 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit ed0da30. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are gdscript).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Godot Weapon System loads about 5.8k tokens when it runs. Until then it costs about 17 tokens; SKILL.md has 51 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from 925236118/AlphaAgent at commit ed0da30, republished under its MIT licence (© 925236118). 51 words, ~5,787 tokens.
.claude/skills/godot-weapon-system/SKILL.md (or your agent's skills folder).完整的武器管理系统,支持多类型武器、快速切换、冷却锁定、输入绑定。
# weapon_type.gd
class_name WeaponType
extends RefCounted
## 武器类型枚举
enum Type {
NONE = -1,
SWORD = 0, # 近战 - 剑
AXE = 1, # 近战 - 斧
HAMMER = 2, # 近战 - 锤
BOW = 3, # 远程 - 弓
CROSSBOW = 4, # 远程 - 弩
STAFF = 5, # 法杖
SHIELD = 6, # 盾牌
THROWING = 7, # 投掷武器
}
## 类型名称映射
const TYPE_NAMES: Dictionary = {
Type.SWORD: "剑",
Type.AXE: "斧",
Type.HAMMER: "锤",
Type.BOW: "弓",
Type.CROSSBOW: "弩",
Type.STAFF: "法杖",
Type.SHIELD: "盾牌",
Type.THROWING: "投掷武器"
}
## 获取类型名称
static func get_name(type: Type) -> String:
return TYPE_NAMES.get(type, "未知")
## 是否是近战武器
static func is_melee(type: Type) -> bool:
return type in [Type.SWORD, Type.AXE, Type.HAMMER, Type.SHIELD]
## 是否是远程武器
static func is_ranged(type: Type) -> bool:
return type in [Type.BOW, Type.CROSSBOW, Type.STAFF, Type.THROWING]# weapon_data.gd
class_name WeaponData
extends Resource
## 武器唯一标识符
@export var id: StringName
## 武器名称
@export var weapon_name: String
## 武器类型
@export var weapon_type: WeaponType.Type = WeaponType.Type.SWORD
## 武器 Prefab 场景
@export var weapon_scene: PackedScene
## 武器图标(用于UI)
@export var icon: Texture2D
## 基础属性
@export var base_damage: int = 10
@export var attack_speed: float = 1.0
@export var attack_range: float = 1.0
## 冷却时间
@export var cooldown: float = 0.5
## 是否需要弹药
@export var needs_ammo: bool = false
@export var max_ammo: int = 0
@export var ammo_type: StringName = &""
## 特殊属性
@export var can_block: bool = false
@export var block_ratio: float = 0.5
## 动画
@export var attack_animation: StringName = &"attack"
@export var idle_animation: StringName = &"idle"
## 获取武器类型名称
func get_type_name() -> String:
return WeaponType.get_name(weapon_type)
## 是否是近战武器
func is_melee() -> bool:
return WeaponType.is_melee(weapon_type)
## 是否是远程武器
func is_ranged() -> bool:
return WeaponType.is_ranged(weapon_type)# weapon.gd
class_name Weapon
extends Node2D
## 信号:攻击开始
signal attack_started
## 信号:攻击结束
signal attack_finished
## 信号:攻击命中
signal attack_hit(target: Node)
## 信号:弹药变化
signal ammo_changed(current: int, max: int)
@export var weapon_data: WeaponData
var _owner: CharacterBody2D
var _current_ammo: int
var _cooldown_timer: float = 0.0
var _is_attacking: bool = false
func _ready() -> void:
_owner = get_owner() as CharacterBody2D
if weapon_data and weapon_data.needs_ammo:
_current_ammo = weapon_data.max_ammo
ammo_changed.emit(_current_ammo, weapon_data.max_ammo)
func _process(delta: float) -> void:
if _cooldown_timer > 0:
_cooldown_timer -= delta
func _physics_process(delta: float) -> void:
pass
## 使用武器攻击
func attack() -> bool:
if not can_attack():
return false
if weapon_data.needs_ammo and _current_ammo <= 0:
return false
_is_attacking = true
_start_attack()
attack_started.emit()
if weapon_data.needs_ammo:
_current_ammo -= 1
ammo_changed.emit(_current_ammo, weapon_data.max_ammo)
# 重置冷却
_cooldown_timer = weapon_data.cooldown
return true
func _start_attack() -> void:
# 播放攻击动画
if _owner.has_method("play_animation"):
_owner.play_animation(weapon_data.attack_animation)
func _end_attack() -> void:
_is_attacking = false
attack_finished.emit()
## 停止攻击
func stop_attack() -> void:
_is_attacking = false
_end_attack()
## 是否可以攻击
func can_attack() -> bool:
if _is_attacking:
return false
if _cooldown_timer > 0:
return false
return true
## 获取剩余冷却时间
func get_cooldown_remaining() -> float:
return maxf(_cooldown_timer, 0.0)
## 装填弹药
func reload(amount: int = 0) -> void:
if not weapon_data.needs_ammo:
return
if amount <= 0:
_current_ammo = weapon_data.max_ammo
else:
_current_ammo = mini(_current_ammo + amount, weapon_data.max_ammo)
ammo_changed.emit(_current_ammo, weapon_data.max_ammo)
## 命中处理(供Hitbox调用)
func on_hit(target: Node) -> void:
attack_hit.emit(target)# sword.gd
class_name Sword
extends Weapon
@export var slash_effect_scene: PackedScene
func _start_attack() -> void:
super._start_attack()
# 生成斩击特效
if slash_effect_scene:
var effect := slash_effect_scene.instantiate()
get_tree().current_scene.add_child(effect)
effect.global_position = global_position
effect.rotation = _owner.rotation
func on_hit(target: Node) -> void:
if target.has_method("take_damage"):
target.take_damage(weapon_data.base_damage)
# 击退效果
if target.has_method("apply_knockback"):
var direction := (target.global_position - _owner.global_position).normalized()
target.apply_knockback(direction, 200.0)# bow.gd
class_name Bow
extends Weapon
@export var arrow_scene: PackedScene
@export var arrow_spawn_offset: Vector2 = Vector2(30, 0)
func _start_attack() -> void:
super._start_attack()
# 发射箭矢
if arrow_scene:
var arrow := arrow_scene.instantiate()
get_tree().current_scene.add_child(arrow)
var spawn_pos := global_position + arrow_spawn_offset.rotated(global_rotation)
arrow.initialize(spawn_pos, _owner.rotation, weapon_data.base_damage)# weapon_switcher.gd
class_name WeaponSwitcher
extends Node
## 信号:武器切换
signal weapon_switched(from_weapon: Weapon, to_weapon: Weapon)
## 信号:武器被锁定
signal weapon_locked(weapon_type: WeaponType.Type, unlock_time: float)
## 信号:切换冷却开始
signal switch_cooldown_started(duration: float)
@export var weapon_slots: Array[WeaponData] = []
@export var max_secondary_weapons: int = 2
## 当前激活的武器索引
var current_weapon_index: int = -1
## 当前武器引用
var current_weapon: Weapon = null
## 武器节点字典
var _weapon_nodes: Dictionary = {}
## 切换冷却
var _switch_cooldown: float = 0.3
var _is_locked: bool = false
var _lock_until: float = 0.0
## 武器类型到索引的映射
var _type_to_index: Dictionary = {}
func _ready() -> void:
_initialize_weapons()
func _process(delta: float) -> void:
_update_cooldown(delta)
_update_lock(delta)
func _update_cooldown(delta: float) -> void:
if _switch_cooldown > 0:
_switch_cooldown -= delta
func _update_lock(delta: float) -> void:
if _is_locked and Time.get_ticks_msec() / 1000.0 >= _lock_until:
_is_locked = false
func _initialize_weapons() -> void:
# 创建所有武器节点
for i in weapon_slots.size():
var data: WeaponData = weapon_slots[i]
if data.weapon_scene == null:
continue
var weapon: Weapon = data.weapon_scene.instantiate()
weapon.weapon_data = data
weapon.set_process(false)
weapon.visible = false
add_child(weapon)
_weapon_nodes[i] = weapon
# 建立类型映射
_type_to_index[data.weapon_type] = i
# 默认装备第一把武器
if weapon_slots.size() > 0:
_equip_weapon(0)
## 切换到指定索引的武器
func switch_to_index(index: int) -> bool:
if index < 0 or index >= weapon_slots.size():
return false
if index == current_weapon_index:
return true
if not can_switch():
return false
_switch_cooldown = 0.3
switch_cooldown_started.emit(_switch_cooldown)
var previous := current_weapon
_unequip_current()
_equip_weapon(index)
weapon_switched.emit(previous, current_weapon)
return true
## 切换到指定类型
func switch_to_type(weapon_type: WeaponType.Type) -> bool:
if _type_to_index.has(weapon_type):
return switch_to_index(_type_to_index[weapon_type])
return false
## 切换到下一把武器(循环)
func switch_to_next() -> bool:
if weapon_slots.size() <= 1:
return false
var next_index := (current_weapon_index + 1) % weapon_slots.size()
return switch_to_index(next_index)
## 切换到上一把武器(循环)
func switch_to_previous() -> bool:
if weapon_slots.size() <= 1:
return false
var prev_index := (current_weapon_index - 1 + weapon_slots.size()) % weapon_slots.size()
return switch_to_index(prev_index)
## 卸下当前武器
func _unequip_current() -> void:
if current_weapon != null:
current_weapon.set_process(false)
current_weapon.visible = false
current_weapon.stop_attack()
## 装备武器
func _equip_weapon(index: int) -> void:
current_weapon_index = index
current_weapon = _weapon_nodes.get(index)
if current_weapon != null:
current_weapon.visible = true
current_weapon.set_process(true)
## 是否可以切换
func can_switch() -> bool:
if _switch_cooldown > 0:
return false
if _is_locked:
return false
if current_weapon != null and current_weapon._is_attacking:
return false
return true
## 锁定特定类型武器
func lock_weapon_type(weapon_type: WeaponType.Type, duration: float) -> void:
_is_locked = true
_lock_until = Time.get_ticks_msec() / 1000.0 + duration
weapon_locked.emit(weapon_type, duration)
## 解锁武器类型
func unlock_weapon_type(weapon_type: WeaponType.Type) -> void:
_is_locked = false
## 获取当前武器数据
func get_current_weapon_data() -> WeaponData:
if current_weapon_index >= 0 and current_weapon_index < weapon_slots.size():
return weapon_slots[current_weapon_index]
return null
## 获取当前武器类型
func get_current_weapon_type() -> WeaponType.Type:
var data := get_current_weapon_data()
if data != null:
return data.weapon_type
return WeaponType.Type.NONE
## 添加武器到槽位
func add_weapon(data: WeaponData) -> bool:
if weapon_slots.size() >= max_secondary_weapons + 1:
return false
weapon_slots.append(data)
var index := weapon_slots.size() - 1
var weapon: Weapon = data.weapon_scene.instantiate()
weapon.weapon_data = data
weapon.set_process(false)
weapon.visible = false
add_child(weapon)
_weapon_nodes[index] = weapon
_type_to_index[data.weapon_type] = index
return true
## 移除武器
func remove_weapon(index: int) -> bool:
if index < 0 or index >= weapon_slots.size():
return false
# 如果是当前武器,切换到另一把
if index == current_weapon_index:
var next_index := (index + 1) % weapon_slots.size()
if next_index != index:
switch_to_index(next_index)
else:
_unequip_current()
current_weapon_index = -1
current_weapon = null
weapon_slots.remove_at(index)
_weapon_nodes.erase(index)
return true# weapon_input_handler.gd
class_name WeaponInputHandler
extends Node
@export var weapon_switcher: WeaponSwitcher
## 输入映射名称
const INPUT_SLOT_1 := "weapon_slot_1"
const INPUT_SLOT_2 := "weapon_slot_2"
const INPUT_SLOT_3 := "weapon_slot_3"
const INPUT_SLOT_4 := "weapon_slot_4"
const INPUT_SLOT_5 := "weapon_slot_5"
const INPUT_NEXT_WEAPON := "next_weapon"
const INPUT_PREV_WEAPON := "prev_weapon"
const INPUT_ATTACK := "attack"
const INPUT_BLOCK := "block"
const INPUT_RELOAD := "reload"
func _ready() -> void:
_setup_input_actions()
func _unhandled_input(event: InputEvent) -> void:
# 攻击
if event.is_action_pressed(INPUT_ATTACK):
_on_attack_pressed()
elif event.is_action_released(INPUT_ATTACK):
_on_attack_released()
# 格挡
elif event.is_action_pressed(INPUT_BLOCK):
_on_block_pressed()
elif event.is_action_released(INPUT_BLOCK):
_on_block_released()
# 切换武器
elif event.is_action_pressed(INPUT_SLOT_1):
weapon_switcher.switch_to_index(0)
elif event.is_action_pressed(INPUT_SLOT_2):
weapon_switcher.switch_to_index(1)
elif event.is_action_pressed(INPUT_SLOT_3):
weapon_switcher.switch_to_index(2)
elif event.is_action_pressed(INPUT_SLOT_4):
weapon_switcher.switch_to_index(3)
elif event.is_action_pressed(INPUT_SLOT_5):
weapon_switcher.switch_to_index(4)
# 循环切换
elif event.is_action_pressed(INPUT_NEXT_WEAPON):
weapon_switcher.switch_to_next()
elif event.is_action_pressed(INPUT_PREV_WEAPON):
weapon_switcher.switch_to_previous()
# 换弹
elif event.is_action_pressed(INPUT_RELOAD):
_on_reload_pressed()
func _setup_input_actions() -> void:
# 在ProjectSettings中设置这些输入映射
# 或者动态创建
pass
func _on_attack_pressed() -> void:
if weapon_switcher.current_weapon != null:
weapon_switcher.current_weapon.attack()
func _on_attack_released() -> void:
if weapon_switcher.current_weapon != null:
weapon_switcher.current_weapon.stop_attack()
func _on_block_pressed() -> void:
var data := weapon_switcher.get_current_weapon_data()
if data != null and data.can_block:
# 播放格挡动画
pass
func _on_block_released() -> void:
pass
func _on_reload_pressed() -> void:
if weapon_switcher.current_weapon != null:
weapon_switcher.current_weapon.reload()[input]
attack = {
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"echo":false,"script":null)
]
}
block = {
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":102,"echo":false,"script":null)
]
}
reload = {
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"echo":false,"script":null)
]
}
next_weapon = {
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"echo":false,"script":null)
]
}
prev_weapon = {
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":122,"echo":false,"script":null)
]
}
weapon_slot_1 = {
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":49,"key_label":0,"unicode":49,"echo":false,"script":null)
]
}
weapon_slot_2 = {
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":50,"key_label":0,"unicode":50,"echo":false,"script":null)
]
}
weapon_slot_3 = {
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":51,"key_label":0,"unicode":51,"echo":false,"script":null)
]
}# weapon_lock_manager.gd
class_name WeaponLockManager
extends Node
## 锁定信息
class LockInfo:
var weapon_type: WeaponType.Type
var unlock_time: float
var reason: String
func _init(type: WeaponType.Type, time: float, reason_str: String):
weapon_type = type
unlock_time = time
reason = reason_str
var _locks: Dictionary = {} # weapon_type -> LockInfo
func _process(delta: float) -> void:
_check_locks(delta)
func _check_locks(delta: float) -> void:
var current_time := Time.get_ticks_msec() / 1000.0
var to_remove: Array
for type in _locks.keys():
var lock: LockInfo = _locks[type]
if current_time >= lock.unlock_time:
to_remove.append(type)
for type in to_remove:
_locks.erase(type)
## 锁定武器类型
func lock(weapon_type: WeaponType.Type, duration: float, reason: String = "") -> void:
var unlock_time := Time.get_ticks_msec() / 1000.0 + duration
_locks[weapon_type] = LockInfo.new(weapon_type, unlock_time, reason)
## 解锁武器类型
func unlock(weapon_type: WeaponType.Type) -> void:
_locks.erase(weapon_type)
## 是否被锁定
func is_locked(weapon_type: WeaponType.Type) -> bool:
return _locks.has(weapon_type)
## 获取剩余锁定时间
func get_remaining_lock_time(weapon_type: WeaponType.Type) -> float:
if not _locks.has(weapon_type):
return 0.0
var current_time := Time.get_ticks_msec() / 1000.0
var unlock_time: float = _locks[weapon_type].unlock_time
return maxf(unlock_time - current_time, 0.0)
## 锁定时触发(用于UI提示)
func _on_weapon_locked(weapon_type: WeaponType.Type, remaining: float) -> void:
print("武器类型 %s 被锁定,剩余时间: %.1f秒" % [WeaponType.get_name(weapon_type), remaining])# 玩家被眩晕时锁定武器
func _on_player_stunned(duration: float) -> void:
var current_type := weapon_switcher.get_current_weapon_type()
weapon_lock_manager.lock(current_type, duration, "眩晕")
# 停止当前攻击
weapon_switcher.current_weapon.stop_attack()
# 武器切换冷却
func _on_switch_cooldown_started(duration: float) -> void:
# 更新UI冷却显示
ui.update_weapon_switch_cooldown(duration)# weapon_bar_ui.gd
class_name WeaponBarUI
extends Control
@export var weapon_switcher: WeaponSwitcher
@export var slot_scene: PackedScene
@onready var slots_container: HBoxContainer = %SlotsContainer
var slotuis: Array[WeaponSlotUI] = []
func _ready() -> void:
weapon_switcher.weapon_switched.connect(_on_weapon_switched)
weapon_switcher.weapon_locked.connect(_on_weapon_locked)
weapon_switcher.switch_cooldown_started.connect(_on_switch_cooldown)
_create_slots()
func _create_slots() -> void:
for i in weapon_switcher.weapon_slots.size():
var slot: WeaponSlotUI = slot_scene.instantiate()
slot.slot_index = i
slot.clicked.connect(_on_slot_clicked)
slots_container.add_child(slot)
slotuis.append(slot)
_update_all_slots()
func _update_all_slots() -> void:
for i in slotuis.size():
var data: WeaponData = weapon_switcher.weapon_slots[i]
slotuis[i].set_weapon_data(data)
slotuis[i].set_selected(i == weapon_switcher.current_weapon_index)
func _on_weapon_switched(from: Weapon, to: Weapon) -> void:
_update_all_slots()
func _on_weapon_locked(weapon_type: WeaponType.Type, unlock_time: float) -> void:
# 更新对应类型的槽位显示锁定状态
for slot in slotuis:
var data: WeaponData = weapon_switcher.weapon_slots[slot.slot_index]
if data.weapon_type == weapon_type:
slot.set_locked(true, unlock_time)
func _on_switch_cooldown(duration: float) -> void:
# 显示切换冷却
for slot in slotuis:
slot.start_cooldown(duration)
func _on_slot_clicked(index: int) -> void:
weapon_switcher.switch_to_index(index)# weapon_slot_ui.gd
class_name WeaponSlotUI
extends PanelContainer
signal clicked(slot_index: int)
@export var slot_index: int = 0
@onready var icon_texture: TextureRect = %IconTexture
@onready var key_label: Label = %KeyLabel
@onready var lock_icon: TextureRect = %LockIcon
@onready var cooldown_overlay: ColorRect = %CooldownOverlay
@onready var selected_border: PanelContainer = %SelectedBorder
var _is_selected: bool = false
var _is_locked: bool = false
var _cooldown_timer: float = 0.0
func _ready() -> void:
gui_input.connect(_on_gui_input)
mouse_entered.connect(_on_mouse_entered)
mouse_exited.connect(_on_mouse_exited)
func _process(delta: float) -> void:
_update_cooldown(delta)
func set_weapon_data(data: WeaponData) -> void:
if data != null and data.icon != null:
icon_texture.texture = data.icon
else:
icon_texture.texture = null
# 显示快捷键
key_label.text = "%d" % (slot_index + 1)
func set_selected(selected: bool) -> void:
_is_selected = selected
selected_border.visible = selected
func set_locked(locked: bool, _unlock_time: float) -> void:
_is_locked = locked
lock_icon.visible = locked
func start_cooldown(duration: float) -> void:
_cooldown_timer = duration
cooldown_overlay.visible = true
func _update_cooldown(delta: float) -> void:
if _cooldown_timer > 0:
_cooldown_timer -= delta
cooldown_overlay.modulate.a = _cooldown_timer / 0.3 # 假设冷却0.3秒
if _cooldown_timer <= 0:
cooldown_overlay.visible = false
func _on_gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
clicked.emit(slot_index)
func _on_mouse_entered() -> void:
modulate = Color(1.2, 1.2, 1.2)
func _on_mouse_exited() -> void:
modulate = Color(1.0, 1.0, 1.0)# player.gd
extends CharacterBody2D
@export var weapon_switcher: WeaponSwitcher
@export var weapon_input_handler: WeaponInputHandler
@export var weapon_lock_manager: WeaponLockManager
func _ready() -> void:
# 初始化武器
weapon_switcher.add_weapon(weapon_database.get_weapon("sword"))
weapon_switcher.add_weapon(weapon_database.get_weapon("bow"))
weapon_switcher.add_weapon(weapon_database.get_weapon("shield"))
func take_damage(amount: float) -> void:
_health -= amount
# 受伤时短暂锁定武器切换
weapon_switcher.lock_weapon_type(weapon_switcher.get_current_weapon_type(), 0.5)
if _health <= 0:
die()
func die() -> void:
# 死亡时切换到徒手
weapon_switcher.switch_to_type(WeaponType.Type.NONE)# weapon_database.gd (Autoload)
extends Node
@export var weapons: Array[WeaponData]
var _weapon_dict: Dictionary = {}
func _ready() -> void:
for weapon in weapons:
_weapon_dict[weapon.id] = weapon
func get_weapon(id: StringName) -> WeaponData:
return _weapon_dict.get(id)
func has_weapon(id: StringName) -> bool:
return _weapon_dict.has(id)© 925236118, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in addons/agent/skills/default_skills/godot-weapon-system of 925236118/AlphaAgent.
Open the folder on GitHubat commit ed0da30
Godot Weapon System next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Godot Weapon System this skill925236118/AlphaAgent | 103 | — | ~5.8k | Automated safety check: Pass | MIT | |
| 2D Map and Scene Generator0x0funky/agent-sprite-forge | 4.4k | — | ~2.9k | Automated safety check: Pass | MIT | |
| Godot UI Integrationzimo-xiao-zheng/godot-ui-integration | 285 | — | ~1.5k | Automated safety check: Pass | MIT | |
| Godot Wechat Minigame Adaptergodothub/godot-minigame | 187 | — | ~1.5k | Automated safety check: Pass | MIT | |
| AI Game Art Pipelineybuild-ai/ai-game-art-pipeline-skill | 297 | — | ~1.1k | Automated safety check: Pass | MIT | |
| MCP DriverRandallLiuXin/GodotMaker | 550 | 1 repos | ~1.1k | Automated safety check: Pass | Custom licence |
0x0funky/agent-sprite-forge
Plans and builds 2D game maps and scenes, from tilemaps and parallax backgrounds to HD-2D plates, with collision checks, a playable HTML preview and Tiled, Godot or LDtk export.
zimo-xiao-zheng/godot-ui-integration
Build or revise Godot UI from an approved design, separated art, or a visual reference when scene structure, gameplay binding, and runtime visual verification all matter.
godothub/godot-minigame
Apply the bundled self-contained Godot WeChat Mini Game adapter kit to an official Godot checkout.
ybuild-ai/ai-game-art-pipeline-skill
Provider-neutral open-source skill for planning and producing game-runtime art assets and animation: static props/icons, canonical character sheets, combat sprites, 3D/video motion references…
RandallLiuXin/GodotMaker
Runtime debugging and live project inspection via godot-mcp.
ukanwat/overtime
Build game cameras that feel good — 2D follow with a deadzone, look-ahead, smoothing, and level-bounds clamping; 3D third-person orbit with collision and first-person look; plus multi-target framing…
925236118/AlphaAgent
Master Godot 4 GDScript patterns including signals, scenes, state machines, and optimization.
925236118/AlphaAgent
Godot 4.x .tscn 场景文件纯文本格式规范与 AI 操作指南 — 文件结构、资源引用、 Transform 变换、属性值格式、信号连接,以及 AI 直接读写 .tscn 文件的操作方法。
925236118/AlphaAgent
Godot 4 Autoload单例模式最佳实践,包含全局管理、事件总线、信号通信. An agent skill from 925236118/AlphaAgent.
925236118/AlphaAgent
Godot 4 Buff系统完整实现,支持状态效果管理、持续时间、循环效果、层叠机制等。使用Resource+Component架构。
925236118/AlphaAgent
Godot 4 建造系统实现,包含GridMap方块管理、第一人称视角、射线交互. An agent skill from 925236118/AlphaAgent.
925236118/AlphaAgent
Godot 4 ECS实体组件系统模式,包含组件化设计、数据与逻辑分离、组件通信. An agent skill from 925236118/AlphaAgent.
Works with
Categories
Godot 4武器切换系统,支持武器类型枚举、武器基类设计、多种切换逻辑、输入绑定和锁定机制. An agent skill from 925236118/AlphaAgent. Godot Weapon System is an agent skill from 925236118/AlphaAgent.
Godot Weapon System fits situations like: tasks that involve Game development.
Run `npx skills add 925236118/AlphaAgent --skill godot-weapon-system -a claude-code`. Or copy the skill folder (addons/agent/skills/default_skills/godot-weapon-system in 925236118/AlphaAgent) into .claude/skills/godot-weapon-system in your project. Claude Code loads it when a task matches its description.
Run `npx skills add 925236118/AlphaAgent --skill godot-weapon-system -a codex`. Or copy the skill folder (addons/agent/skills/default_skills/godot-weapon-system in 925236118/AlphaAgent) into .agents/skills/godot-weapon-system in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add 925236118/AlphaAgent --skill godot-weapon-system -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/godot-weapon-system, .gemini/skills/godot-weapon-system, .github/skills/godot-weapon-system and .opencode/skills/godot-weapon-system in your project.
SKILL.md names no scripts, command-line tools or credentials: Godot Weapon System is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Godot Weapon System is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 5.8k tokens (SKILL.md is roughly 23k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Godot Weapon System: 2D Map and Scene Generator (0x0funky/agent-sprite-forge, 4.4k stars), Godot UI Integration (zimo-xiao-zheng/godot-ui-integration, 285 stars), Godot Wechat Minigame Adapter (godothub/godot-minigame, 187 stars) and AI Game Art Pipeline (ybuild-ai/ai-game-art-pipeline-skill, 297 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
925236118 (a GitHub user) maintains it in 925236118/AlphaAgent, which has 103 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on October 8, 2026.
Source: 925236118/AlphaAgent on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.