Extended the enemy death checkpoint respawn system to work with enemies in Areas 4, 5, and 6.
Used by: Bat enemies and Slime enemies (both use bat.gd script) Change: Added checkpoint respawn tracking for non-stomp collisions
func _on_Hurtbox_body_entered(body: Node) -> void:
if body is CharacterBody2D:
# Stomp kills bat
if body.global_position.y < global_position.y - 4:
queue_free()
if body.has_method("bounce"):
body.bounce()
else:
# Player hit from side - record checkpoint respawn
if RespawnManager:
RespawnManager.set_death_cause("hazard")
RespawnManager.record_death_position(body.global_position)
if body.has_method("take_damage"):
body.take_damage(1)Behavior:
- ✅ Stomp from above → Bat dies, player bounces (no player damage)
- ✅ Hit from side → Player damaged, respawns at checkpoint (energy cell)
Used by: Plant enemy projectiles Change: Added checkpoint respawn tracking when bullet hits player
func _on_body_entered(body: Node) -> void:
if body is CharacterBody2D:
# Record checkpoint respawn for plant bullet hit
if RespawnManager:
RespawnManager.set_death_cause("hazard")
RespawnManager.record_death_position(body.global_position)
if body.has_method("take_damage"):
body.take_damage(damage)
queue_free()Behavior:
- ✅ Bullet hits player → Player damaged, respawns at checkpoint (energy cell)
- Enemies: Ghost (no collision), Bat
- Energy Cells: Orange and Banana checkpoints
- Behavior: Bat collisions now use checkpoint respawn
- Enemies: Slime (uses bat.gd script), Spinning saw hazards
- Energy Cells: 7 energy cells
- Behavior: Slime collisions now use checkpoint respawn
- Enemies: Plant (shoots bullets), Slime, Bluebird, Spinning saw hazards
- Energy Cells: 8 energy cells
- Behavior:
- Plant bullet hits use checkpoint respawn
- Slime collisions use checkpoint respawn
- Bluebird already had checkpoint respawn (updated earlier)
- Death cause:
"fall" - Respawn location: Area start position
- Does NOT use checkpoint
- Death cause:
"hazard" - Respawn location: Near energy cell checkpoint
- Uses checkpoint (fruit-based respawn points)
✅ Area 1: Radish, Snail, Duck ✅ Area 2: Radish, Snail, Duck, Bluebird ✅ Area 4: Bat ✅ Area 5: Slime (uses bat.gd), Spinning saws ✅ Area 6: Plant (bullets), Slime (uses bat.gd), Bluebird
- Area 4: Die to Bat → Should respawn at orange/banana checkpoint
- Area 5: Die to Slime → Should respawn at energy cell checkpoint
- Area 6: Die to Plant bullet → Should respawn at energy cell checkpoint
- Area 6: Die to Slime → Should respawn at energy cell checkpoint
- All areas: Fall off map → Should respawn at area start (not checkpoint)
- All areas: Collect new energy cell → Checkpoint updates to new position
All enemy types across Areas 1, 2, 4, 5, and 6 now consistently use the checkpoint respawn system when killing the player through hazard contact.