Create Dual-Mode Enemy

Create GameMaker enemies that switch between melee and ranged attacks based on distance.

Updated Oct 11, 2025
One-click install
npx skills add https://github.com/progressions/Shadow-Work --skill create-dual-mode-enemy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Create Dual-Mode Enemy
Source: https://github.com/progressions/Shadow-Work/tree/main/.claude/skills/create-dual-mode-enemy
Command: npx skills add https://github.com/progressions/Shadow-Work --skill create-dual-mode-enemy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the tedious manual coding of complex enemy AI in GameMaker, especially for foes requiring dynamic attack switching, tactical behavior, and seamless integration with existing game systems like traits and formations. It automates the setup and logic, significantly reducing development time and potential bugs.

Core Features & Use Cases

  • Dynamic Attack Switching: Create enemies that intelligently switch between melee and ranged attacks based on distance, line of sight, cooldowns, and their assigned formation roles.
  • Configurable Tactical Behavior: Easily define preferred attack modes, range thresholds, retreat behaviors, and integrate custom sounds and traits.
  • Use Case: Quickly design a "Forest Archer" enemy that prioritizes ranged attacks but switches to melee if the player gets too close, retreating to maintain optimal distance, all while inheriting existing game traits like "arboreal" for environmental advantages.

Quick Start

Create a GameMaker enemy that prefers ranged attacks but switches to melee if the player is within 48 pixels, and retreats if too close. Ensure it has 47-frame sprites and uses "snd_arrow_fire" for ranged and "snd_sword_hit" for melee.

Frequently Asked Questions about Create Dual-Mode Enemy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an enemy in GameMaker that switches between melee and ranged attacks?

Dual-mode enemies switch between melee and ranged attacks based on distance, line of sight, and cooldowns. Define separate stat sets for each mode, set distance thresholds, and use formation roles to control behavior—ranged enemies retreat when threatened, melee enemies advance when targets are close.

Can I use GameMaker enemy AI with tactical formations and dynamic positioning?

Yes. Tactical combat in GameMaker benefits from formation-aware enemies that adapt their attack mode based on role—frontline units prioritize melee, backline units prefer ranged. This Skill configures those behaviors with independent cooldowns and line-of-sight checks.

What's the best way to reduce GameMaker enemy AI coding time without sacrificing behavior complexity?

Automated enemy configuration eliminates manual AI logic for attack switching, cooldown management, and formation integration. Pre-built dual-mode setups with configurable thresholds and sprite support reduce development time and common bugs significantly.

Do I need custom sprite animations to implement dual-mode enemies in GameMaker?

The Skill supports configurable sprite frames for both melee and ranged animations. If you have 47-frame sprites and assign sound effects like snd_arrow_fire and snd_sword_hit, dual-mode switching handles frame selection automatically.

How do GameMaker traits and formations integrate with enemy attack switching?

Formation overrides determine primary attack mode and retreat distance, while tag-based traits apply environmental advantages or stat modifications. The Skill binds both systems so enemies inherit game traits and respect formation roles during attack decisions.

What happens when a GameMaker enemy's ranged attack is blocked or line of sight is broken?

Line-of-sight checks prevent ranged attacks through obstacles; blocked enemies automatically fall back to melee if the player is in range, or retreat to reposition. Independent cooldowns for each mode ensure smooth transitions without attack overlap.