Explosion_der_Spiele/scripts/combat/hazard_zone.gd
copilot 938cc4bc82 Initial scaffold: Godot 4.3 scenes, systems, and placeholders.
Wire all twelve levels with billboard prefabs, autoload systems (inventory, achievements, mock shop, DE/EN/BY), and satire audio locks so the Title→End flow is playable with placeholder assets.
2026-09-14 18:36:02 +02:00

24 lines
592 B
GDScript

extends Area3D
class_name HazardZone
## Damages the player on enter.
@export var damage: int = 1
@export var death_cause_key: String = "death_default"
@export var cooldown: float = 1.0
var _ready_to_hurt: bool = true
func _ready() -> void:
body_entered.connect(_on_body_entered)
collision_layer = 0
collision_mask = 2
func _on_body_entered(body: Node3D) -> void:
if not _ready_to_hurt:
return
if not body.is_in_group("player"):
return
_ready_to_hurt = false
GameState.take_damage(damage, death_cause_key)
await get_tree().create_timer(cooldown).timeout
_ready_to_hurt = true