Made vulnerable and spawn code not depend on the enemy type. Hopefully nothing broke.

This commit is contained in:
Storm Dragon
2025-02-17 12:52:53 -05:00
parent fdb8381603
commit 5b0615db7f
6 changed files with 153 additions and 70 deletions

View File

@@ -80,7 +80,7 @@ Zombie spawn chance is 0-100, higher means more zombies. Item is also optional,
{
"x_range": [20, 35], // patrol or hunting range
"y": 0,
"enemy_type": "goblin", // goblin, witch, ghoul, boogie_man, ghost, revenant
"enemy_type": "goblin",
"health": 4,
"damage": 2,
"attack_range": 1.5,
@@ -93,6 +93,58 @@ Zombie spawn chance is 0-100, higher means more zombies. Item is also optional,
Attacks can be "hunter" or "patrol". The "patrol" option does not use the "turn_threshold" option. The "turn_threshold" option is how quickly the hunting enemy will turn around to attack the player. Hunters will leave their area to pursue the player once he has entered the enemy's range.
#### Special Enemy Behaviors
Enemies can have special behaviors regardless of their type. Here are some examples:
##### incorporeal Goblin
``` json
{
"x_range": [400, 415],
"y": 0,
"enemy_type": "goblin",
"health": 30,
"damage": 2,
"attack_range": 1,
"has_vulnerability": true,
"is_vulnerable": false,
"vulnerability_duration": 1000,
"invulnerability_duration": 5000,
"speed_multiplier": 0.8,
"attack_cooldown": 1200,
"attack_pattern": {
"type": "hunter",
"turn_threshold": 2
}
}
```
##### Spawning Other Enemies (like revenants)
You can mix and match these behaviors. For an example of a witch who spawns black cats, see "Wicked Quest/13.json"
## Sound Requirements for Special Behaviors
When adding special behaviors to enemies, you'll need corresponding sound files:
For vulnerability system:
- enemy_is_vulnerable.ogg - Sound when enemy becomes vulnerable
For spawning behavior:
- enemy_spawn.ogg (optional) - Sound when spawning new enemies
## Tips for Custom Enemies
- Balance special behaviors carefully
- Test enemy combinations thoroughly
- Consider providing audio cues for special behaviors
- Remember faster enemies should generally do less damage
- Vulnerability systems work best with higher health values
- Spawning enemies should have lower health to compensate
### Hazards
#### Skull Storm

View File

@@ -257,16 +257,25 @@
"static": true
},
{
"x_range": [400, 420],
"type": "spider_web",
"x": 395,
"y": 0
},
{
"x_range": [400, 415],
"y": 0,
"enemy_type": "revenant",
"health": 40,
"damage": 1,
"attack_range": 1,
"zombie_spawn_cooldown": 2500,
"attack_pattern": {
"type": "patrol"
}
},
"can_spawn": true,
"spawn_type": "zombie",
"spawn_cooldown": 2500,
"spawn_chance": 100,
"spawn_distance": 5
}
],
"boundaries": {

View File

@@ -334,7 +334,12 @@
"attack_range": 2,
"attack_pattern": {
"type": "patrol"
}
},
"can_spawn": true,
"spawn_type": "black_cat",
"spawn_cooldown": 5000,
"spawn_chance": 75,
"spawn_distance": 4
},
{
"x_range": [405, 495],

View File

@@ -327,14 +327,17 @@
"health": 30,
"damage": 2,
"attack_range": 1,
"has_vulnerability": true,
"is_vulnerable": false,
"vulnerability_duration": 1000,
"invulnerability_duration": 5000,
"speed_multiplier": 0.8,
"attack_cooldown": 1200,
"attack_pattern": {
"type": "patrol"
"type": "hunter",
"turn_threshold": 2
}
}
}
],
"boundaries": {
"left": 0,