[← Previous: Part 4 (C++) - Create the Enemy](part-4-cpp-create-enemy.md) | [Back to Index](README.md) | [Next: Part 6 (C++) - Create Game Director →](part-6-cpp-create-game-director.md)
---
## Overview
Create an enemy spawner that gradually increases difficulty over time. Copy-paste variables instead of manual UI configuration.
1. From Content Browser "C++ Classes" folder, find `STGEnemySpawner`
2. Can either:
- **Option A**: Drag directly into level (no Blueprint needed!)
- **Option B**: Create `BP_EnemySpawner` Blueprint child for tweaking values in editor
3. Position spawner at origin (0, 0, 0) or anywhere - location doesn't matter for spawning
---
## Step 5.6: Test Spawning
1. Remove any manually-placed enemies from level
2. Make sure spawner is placed
3. Press **Play**
### Expected Result in Play Mode:
**Spawning behavior:**
- ✅ Enemies spawn at top of screen every ~2 seconds initially
- ✅ Spawn rate gradually increases (gets faster over time)
- ✅ Enemies spawn at random horizontal positions
- ✅ Maximum of 120 enemies on screen at once
- ✅ After 5 minutes (300 seconds), spawning stops
**Visual confirmation:**
- Enemies appear from top edge of screen
- Each spawns at a different Y position (left-right spread)
- As time passes, enemies spawn more frequently
- Game becomes progressively harder
**Performance:**
- Even with many enemies, game maintains 60 FPS
- No lag or stuttering when many enemies/bullets on screen
---
## Comparison Summary
### Blueprint: ~40 minutes
- Create spawner Blueprint
- Add 6 variables manually
- Create spawn rate curve asset
- Complex Blueprint nodes for curve sampling
- Random position calculation nodes
- Enemy counting logic
### C++: ~10 minutes
- Create C++ class
- Copy-paste variables and logic
- Compile
- Place in level
**Time saved: 30 minutes** ⚡
---
[← Previous: Part 4 (C++) - Create the Enemy](part-4-cpp-create-enemy.md) | [Back to Index](README.md) | [Next: Part 6 (C++) - Create Game Director →](part-6-cpp-create-game-director.md)